技术解析

求助:PHP+apache 的伪静态规则,转换成 nginx 适用的
0
2021-07-16 16:59:27
idczone
RewriteEngine on
RewriteCond $1 !^(index\.php|templates|upload|images|js|css|cache|plugins|spec|favicon\.ico|robots\.txt|phpmyadmin)
RewriteRule ^(.*)$ /index.php/$1 [L]


搞了很久了都没搞定,求助……
PHP+apache的伪静态规则如下:
RewriteEngine on
RewriteCond $1 !^(index\.php|templates|upload|images|js|css|cache|plugins|spec|favicon\.ico|robots\.txt|phpmyadmin)
RewriteRule ^(.*)$ /index.php/$1 [L]

在我的博客搜 nginx 可以找到答案!
www.crazyppher.com
我现在太卡le !只能帮你到这!

www.crazyppher.com
进不去呀

是crazyphper.com吧?

如果你的地址都是类似于这样 http://www.example.com/login
这样的话可以这么写
location .*.php {
if (!- e $request_filename) {
rewrite ^(.*)$ /index.php/$1 break;
}
}

if ($1 !~ "^(index\.php|templates|upload|images|js|css|cache|plugins|spec|favicon\.ico|robots\.txt|phpmyadmin)"){
set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
rewrite ^/(.*)$ /index.php/$1 last;
}
推荐一个 将 apache 重写规则在线转为 nginx 重写规则的工具:
http://www.51ask.org/apache2nginx/

数据地带为您的网站提供全球顶级IDC资源
在线咨询
专属客服