Laravel 4.1:URL以" /"结束不工作

时间:2014-02-11 03:51:22

标签: php laravel-4

我刚刚发现,使用Laravel 4.1,当URL以“/”结尾时,它将无效。例如:mydomain.com/contactus有效,但mydomain.com/contactus/无效。

这通常不是Laravel 4.0的问题。我该如何解决这个问题呢?

1 个答案:

答案 0 :(得分:1)

Laravel 4.1 .htaccess有一个重定向规则来管理它,请查看Redirect Trailing Slashes...

<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>