2016-07-11 46 views
1

的index.php我能夠從我的網址刪除.PHP但是在PHP MVC框架不能刪除的index.php。其實我需要/app/className/action而不是/index.php/app/className/action能夠去除PHP擴展,但不能從PHP MVC URL模式

的.htaccess文件結構波紋管,

Options +FollowSymLinks -MultiViews 
<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA] 
</IfModule> 

此規則返回/指數/應用/類名/動作,而不是/應用/類名/動作

在此先感謝您的幫助。

回答

0

要刪除index.php,您可以使用以下規則:

Options +FollowSymLinks -MultiViews 
<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    #Redirect /index.php/foobar to /foobar 
    RewriteCond %{THE_REQUEST} /index\.php/.+ [NC] 
    RewriteRule ^index.php/(.+)$ /$1 [L,R] 
    #internally map /foobar back to /index.php/foobar 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
</IfModule> 
0

試試這個

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