删除laravel路由的index.php

时间:2018-04-02 08:57:31

标签: laravel .htaccess laravel-routing laravel-5.6

当我在域名末尾添加index.phpwww.example.com/index.php)然后点击其他路由时,index.php会添加到他们的网址。但我在其他Laravel网站上看到,即使你添加index.php然后点击其他路线,网址也将是:
www.example.com/ROUTE_NAME (我的意思是index.php已经消失。)

我如何为我的网站实现这一目标?
我正在使用共享主机(Apache + Nginx)和我的.htaccess文件:

<IfModule mod_rewrite.c>

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

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

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

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

</IfModule> 

0 个答案:

没有答案