ThinkPHP 在nginx环境下去掉URL中的index.php
2016-11-06 22:19
716 查看
在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现:
location /{// …..省略部分代码
if(!-e $request_filename){
rewrite^(.*)$/index.php?s=$1last;
break;
}
}
其实内部是转发到了ThinkPHP提供的兼容模式的URL,利用这种方式,可以解决其他不支持PATHINFO的WEB服务器环境。
如果你的ThinkPHP安装在二级目录,Nginx的伪静态方法设置如下,其中youdomain是所在的目录名称。
location /youdomain/{
if(!-e $request_filename){
rewrite^/youdomain/(.*)$/youdomain/index.php?s=$1last;
}
}
本文出自 “Centi.Linux” 博客,请务必保留此出处http://centilinux.blog.51cto.com/1454781/1265218
location /{// …..省略部分代码
if(!-e $request_filename){
rewrite^(.*)$/index.php?s=$1last;
break;
}
}
其实内部是转发到了ThinkPHP提供的兼容模式的URL,利用这种方式,可以解决其他不支持PATHINFO的WEB服务器环境。
如果你的ThinkPHP安装在二级目录,Nginx的伪静态方法设置如下,其中youdomain是所在的目录名称。
location /youdomain/{
if(!-e $request_filename){
rewrite^/youdomain/(.*)$/youdomain/index.php?s=$1last;
}
}
本文出自 “Centi.Linux” 博客,请务必保留此出处http://centilinux.blog.51cto.com/1454781/1265218
相关文章推荐
- ThinkPHP 在nginx环境下去掉URL中的index.php
- ThinkPHP 在nginx环境下去掉URL中的index.php
- ThinkPHP 在nginx环境下去掉URL中的index.php
- CI框架apache和nginx环境下面统一去掉路径URL后面的index.php
- CI在nginx环境下去掉url中的index.php
- ThinkPHP 在 Nginx 下 支持PATHINFO 去掉index.php的写法
- 在nginx下去掉ci框架url中的index.php
- ThinkPHP去掉URL中的index.php
- nginx服务器去掉url中的index.php 和 配置path_info
- nginx去掉url中的index.php
- Nginx服务器下ThinkPHP5访问出现404以及URL隐藏index.php
- ThinkPHP框架在nginx+https环境下无法去除index.php ?
- ThinkPHP如何URL如何去掉index.php(重写模式)
- thinkPHP如何去掉url中的index.php
- ThinkPHP-URL中去掉index.php
- ThinkPHP去掉URL中的index.php
- thinkphp在wamp 配置去掉url中index.php方法
- thinkphp 去掉URL 里面的index.php
- windows下修改nginx pathinfo支持、thinkphp在nginx环境下隐藏index.php