0
我想重写Apache中的.htaccess规则以用于Nginx服务器。apache/nginx:.htaccess重写转换混乱
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;
}
邪恶的,这个伟大的作品!现在唯一的问题是查询字符串没有正确地传递给ajax页面,并且它导致整个index.php重新加载到ajax的区域内。有关于此的任何想法? – wunderbar 2011-05-09 15:23:58
重写位置/应自动保留查询字符串。你编辑过你的fastcgi_params文件吗?它应该有一行:fastcgi_param QUERY_STRING $ query_string; – kolbyjack 2011-05-09 20:19:36