【发布时间】:2011-08-21 10:56:57
【问题描述】:
我正在尝试从 Apache 重写 .htaccess 规则以在 Nginx 服务器上使用。
RewriteCond $1 !^(index\.php|assets)
RewriteRule ^(.*)$ /index.php/$1 [L]
这是我所拥有的工作,但如果有更好的方向,将不胜感激。我可以点击索引,它可以正常加载并浏览到资产文件夹,但更深的链接不起作用(PHP 程序正在从 URL 中提取变量来构建数据库查询)。我知道我很接近了.. 感谢您的任何回复。
location / {
index index.php;
}
location /$ {
rewrite ^/(.*)$ /index.php/$1 last;
}
location /index.php {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
【问题讨论】:
标签: apache mod-rewrite url-rewriting nginx rewrite