我刚刚发现,使用Laravel 4.1,当URL以“/”结尾时,它将无效。例如:mydomain.com/contactus
有效,但mydomain.com/contactus/
无效。
这通常不是Laravel 4.0的问题。我该如何解决这个问题呢?
答案 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>