2015-10-02 131 views
0

漂亮的網址有問題我想從URL中移除index.php訪問控制器動作。因此,我下面的代碼添加在我.htaccess文件中的文件夾public/在Laravel 5.1

Options +FollowSymLinks 
RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [L] 

我將不勝感激,如果有人回覆了我和解決這個問題。

+0

你能解釋一下嗎? – hjpotter92

+0

問題是什麼? –

+0

我的.htaccess代碼是上面URL中的公共/ index.php文件之後,除去index.php文件和訪問路徑的文件,即公共/ index.php文件/車,我的確切需求路由控制器中的操作是刪除索引。 PHP文件形成example.com/public/index.php/car –

回答

0

爲什麼不使用默認的Laravel .htaccess文件。你應該好好處理它。

<IfModule mod_rewrite.c> 
    <IfModule mod_negotiation.c> 
     Options -MultiViews 
    </IfModule> 

    RewriteEngine On 

    # Redirect Trailing Slashes... 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

    # Handle Front Controller... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 
</IfModule>