TP5配置隱藏入口index.php文件,Apache/phpstudy

一,找到/public/.htaccess文件,若是你的入口文件已經移動到根目錄下,那麼你的.htaccess文件也要剪切到根目錄下,總之要確保.htaccess跟入口的index.php保持同級。php

二,根據你的php環境分別設置.htaccess文件:iview

Apache:3d

<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:code

<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>

相關文章
相關標籤/搜索