Home  >  Article  >  Backend Development  >  thinkphp掩藏index.php以后500

thinkphp掩藏index.php以后500

WBOY
WBOYOriginal
2016-06-13 12:00:38754browse

thinkphp隐藏index.php以后500
系统linux+php5.3
tp3.1.2  

按照TP的手册说修改 httpd.conf 的  mod_rewrite.so 模块分号
然后还有 AllowOverride None 将None改为 All (这个地方在httpd.conf里面有5处,我都修改成了All,不知道是否是正确的,还是只是需要修改一处就可以了?)

URL_MODEL设置为2   这个在配置文件里面也设置成了2,然后在写一个 ..htaccess 放在网站的根目录,内容如下


RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]


然后重新启动httpd,结果提示 500 Internal Server Error ,开始我以为是我apache的问题,最后我看其他的网站又正常(这台linux有多个网站),最后把 .htaccess删除以后打开网站又恢复正常,如果在放.htaccess又出现问题,那就可以说明.htaccess有问题了,是不是这个里面的内容有问题呢,还是需要php.ini在设置其他的呢



------解决方案--------------------

<IfModule mod_rewrite.c><br />RewriteEngine on<br /><br />#如果目录存在就直接访问目录不进行RewriteRule<br />RewriteCond %{REQUEST_FILENAME} !-d<br />#如果文件存在,就直接访问文件,不进行下面的RewriteRule.(不是文件或文件不存在就执行重写)<br />RewriteCond %{REQUEST_FILENAME} !-f<br />#所有找不着实际路径的文件,统一交给index.php处理<br />RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]<br /></IfModule>

TP 自己就带有 .htaccess

你看看这里 http://blog.csdn.net/qq1355541448/article/details/21375407

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn