[英]rewrite htaccess apache to nginx
How to convert this rewrite code: 如何转换此重写代码:
RewriteCond $1 !^(index\.php|static|favicon\.ico|robots\.txt|sitemap.xml|google(.+)\.html)
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
This is from Stikked script https://github.com/claudehohl/Stikked/blob/master/htdocs/.htaccess 这来自Stikked脚本https://github.com/claudehohl/Stikked/blob/master/htdocs/.htaccess
I try to reproduce it in nginx format, but get error that variable $1
is unknow 我尝试以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;
}
Try this: 尝试这个:
if ($request_uri !~ "^(index.php|static|favicon.ico|robots.txt|sitemap.xml|google(.+).html)"){
rewrite ^/(.*)$ /index.php?/$1 last;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.