2017-07-25 64 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 –