以下是apache重写规则
RewriteCond %{REQUEST_URI} index.php$
RewriteCond %{QUERY_STRING} ^search=([A-Za-z0-9+]+)$
RewriteRule ^(.*)$ /mp3-%1.html? [R=301,L]
RewriteRule ^mp3-([^+]+)+([^.]+).html$ /mp3-$1-$2.html [R=301,L]
RewriteRule ^mp3-(.*).html$ index.php?search=$1&a=1 [L]
RewriteRule ^mp3-([a-zA-Z0-9_-]+)-([^-]*).htm$ /index.php?search=$1&page=$2 [L]
我尝试了所有转换器网站将其从.htaccess转换为nginx配置。他们中的一些人得出以下结果
if ($http_host ~* "^domain.com"){
set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
rewrite /(.*) http://www.mp3ecevir.net/$1 permanent;
}
if ($uri ~ "index.php$"){
set $rule_1 1$rule_1;
}
if ($args ~ "^search=([A-Za-z0-9+]+)$"){
set $rule_1 2$rule_1;
set $bref_1 $1;
}
if ($rule_1 = "21"){
rewrite ^/(.*)$ /mp3-$bref_1.html? permanent;
}
rewrite ^/mp3-([^+]+)+([^.]+).html$ /mp3-$1-$2.html permanent;
rewrite ^/mp3-(.*).html$ /index.php?search=$1&a=1 last;
rewrite ^/mp3-([a-zA-Z0-9_-]+)-([^-]*).htm$ /index.php?search=$1&page=$2 last;
但它不会重写吗?我做错了什么?
顺便说一下
这是我的htaccess文件:http://pastebin.com/KfvK2SNK
这是nginx:http://pastebin.com/uSH5trfG