2017-07-25 57 views
1

我在设置新服务器后想出了这个问题。当我点击一个路由时,laravel在本地主机之后放置一个index.php。例如localhost/index.php/mysite/public/login.如何在localhost后删除index.phplaravel在localhost后添加URL中的index.php

+0

https://stackoverflow.com/questions/37507209/how-to-hide-config-files-from-直接访问 –

+0

同样的结果。每次我点击它仍然重定向的东西index.php –

+0

这意味着你没有正确设置网络服务器,或者你没有重新启动它。 –

回答

0

请确保您有内部与下面的代码公共文件夹的.htaccess文件:

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

    RewriteEngine On 

    # Redirect Trailing Slashes If Not A Folder... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

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

    # Handle Authorization Header 
    RewriteCond %{HTTP:Authorization} . 
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
</IfModule> 
+0

我已经有.htaccess,但结果相同。 –

+0

您正在使用哪个服务器? –

+0

即时通讯使用Windows Server 2012 R2 –