2015-10-02 90 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>