ThinkPHP 下如何隐藏index.php

最近一直在做孕妈团的项目,因为部署到实际项目中出现了链接打不开的情况,要默认添加index.php才能正常访问。

当时忘了是Tinkphp的URL重写模式:以后遇到相同问题,首先要想到URL重写模式。

  1. httpd.conf配置文件中加载了mod_rewrite.so模块
  2. AllowOverride None 将None改为 All
  3. 把下面的内容保存为.htaccess文件放到应用入口文件的同级目录下 

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond $1 !^(DATA|images|otherThings)
RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
</IfModule>

posted @ 2016-05-17 14:42  雷江生  阅读(3688)  评论(0编辑  收藏  举报