tp5无法隐藏index.php入口文件问题
来源:紫晶悦城建站 发布时间:2018-05-22 浏览次数:
今天做的网页,从导航链接上再点回其他页时,因为路径内没有index.php,报找不到网页,那怎么把index.php隐藏呢?应用环境为phpStudy2018,apache,应用为TP5框架,但在在网站找了好多资料,都是说改.htaccess文件。
如下:
<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>
但进了测试,就是不行,后最终找到方法,是最后一行index.php?“/”的问题,把最后一行中的“/”改为“s=”就可以了
如下:
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L] </IfModule>