我试图转换以下 .htaccess 规则
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^([^.]+\.[^.]+|[^.]+)\.domain\.com$ [NC]
RewriteRule ^(.*)$ /index.php?type=%1&b=$1&%{QUERY_STRING} [L]
使用 nginx .htaccess 转换器我最终得到了这个:
if ($http_host ~ "^www\.domain\.com$"){
set $rule_0 1;
}
if ($rule_0 = "1"){
rewrite ^/(.*)$ http://domain.bg/$1 permanent;
}
if (!-f $request_filename){
set $rule_1 1$rule_1;
}
if ($http_host ~* "^([^.]+\.[^.]+|[^.]+)\.domain\.com$"){
set $rule_1 2$rule_1;
set $bref_1_0 $1;
}
if ($rule_1 = "21"){
rewrite ^/(.*)$ /index.php?type=${bref_1_0}&b=$1&$args last;
}
但它不工作。有人可以帮忙吗?