在nginx环境下的path_info重写问题
2015年8月25日
没有评论
我们需要将/c/目录下的所有文件都重写到index.php,让index.php来处理
当然会传递path_info,比如:
/c/123.html,实际访问的是:index.php
index.php中使用pathinfo($_SERVER[‘PHP_SELF’])进行操作
按照一般的重写是:
rewrite ^/c/(.*)$ /c/index.php/$1 last;
实际上应该用:(建议在nginx配置文件中的location ~ \.php$ {}中加入)
if (!-e $request_filename){
rewrite ^/c/(.*)$ /c/index.php?/$1 last;
}
近期评论