TP5隐藏index.php

匿名 (未验证) 提交于 2019-12-02 22:11:45

一,找到/public/.htaccess文件,如果你的入口文件已经移动到根目录下,那么你的.htaccess文件也要剪切到根目录下,总之要确保.htaccess跟入口的index.php保持同级。

二,根据你的php环境分别设置.htaccess文件:

Apache:

<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>

phpstudy:

<IfModule mod_rewrite.c>  Options +FollowSymlinks -Multiviews  RewriteEngine on  RewriteCond %{REQUEST_FILENAME} !-d  RewriteCond %{REQUEST_FILENAME} !-f  RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]  </IfModule>

Nginx(在Nginx.conf中添加):

location / { // …..省略部分代码     if (!-e $request_filename) {         rewrite  ^(.*)$  /index.php?s=/$1  last;         break;     } }
文章来源: TP5隐藏index.php
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!