QQ登录 账号密码登陆 官网首页
首页 > B2B2C商城 > 开发手册 > 基础教程 > 正文

隐藏index.php(window-apache)

有些朋友提到关于TPshop 在window的apache下隐藏index.php 一问题, 可以修改 ApplicationCommonConfconfig.php 文件代码 

1
2
3
4
5
6
common,
    AUTH_CODE => "TPSHOP"//安装完毕之后不要改变,否则所有密码都会出错
    //URL_CASE_INSENSITIVE => false, //URL大小写不敏感
    LOAD_EXT_CONFIG=>db,route// 加载数据库配置文件
    LOAD_EXT_CONFIG=>db// 加载数据库配置文件
    URL_MODEL=>2, // 如果需要 隐藏 index.php  打开这行"URL_MODEL"注释 同时在apache环境下 开启 伪静态模块,  如果在nginx 下需要另外配置,参考thinkphp官网手册


有些环境刚修改上面还是不行,需要另外修改根目录下的 .htaccess  文件  

1
2
3
4
5
6
7
  Options +FollowSymlinks
  RewriteEngine On
 
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]  
  RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]

原来的

 RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]  

改成

 RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]  

重启apache  试试。


对于nginx 用户 请查看thinkphp 官网手册说明