user1995781
user1995781

Reputation: 19463

Laravel 4.1: URL ended with "/" not working

I just found that with Laravel 4.1, when an URL ended with "/" it will not works. For example: mydomain.com/contactus works, but mydomain.com/contactus/ not working.

This usually wasn't a problem with Laravel 4.0. How can I fix this to make it work?

Upvotes: 1

Views: 92

Answers (1)

Antonio Carlos Ribeiro
Antonio Carlos Ribeiro

Reputation: 87789

Laravel 4.1 .htaccess has a redirect rule to manage that, look at the 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>

Upvotes: 1

Related Questions