将htaccess-apache重写为nginx
如何转换此重写代码:将htaccess-apache重写为nginx,apache,.htaccess,mod-rewrite,nginx,Apache,.htaccess,Mod Rewrite,Nginx,如何转换此重写代码: RewriteCond $1 !^(index\.php|static|favicon\.ico|robots\.txt|sitemap.xml|google(.+)\.html) RewriteRule ^(.*)$ index.php?/$1 [QSA,L] 这是斯蒂克的剧本 我试图以nginx格式复制它,但得到的错误是变量$1未知 if ($1 !~ "^(index.php|static|favicon.ico|robots.txt|sitemap.xml|goo
RewriteCond $1 !^(index\.php|static|favicon\.ico|robots\.txt|sitemap.xml|google(.+)\.html)
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
这是斯蒂克的剧本
我试图以nginx格式复制它,但得到的错误是变量$1
未知
if ($1 !~ "^(index.php|static|favicon.ico|robots.txt|sitemap.xml|google(.+).html)"){
set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
rewrite ^/(.*)$ /index.php?/$1 last;
}
试试这个:
if ($request_uri !~ "^(index.php|static|favicon.ico|robots.txt|sitemap.xml|google(.+).html)"){
rewrite ^/(.*)$ /index.php?/$1 last;
}
非常感谢。非常地