Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel trailing Slashes redirect to localhost

When I try this

http://localhost/Testlaravel/public/users/login

it works. But when I try

http://localhost/Testlaravel/public/users/login/ 

it redirects me to

http://localhost/users/login/

Any idea why?

This my htaccess file

<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>
like image 628
user3213240 Avatar asked Feb 12 '14 17:02

user3213240


1 Answers

Change your code to this:

Options -MultiViews
RewriteEngine On
RewriteBase /Testlaravel/public/

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ $1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
like image 106
anubhava Avatar answered Oct 04 '22 04:10

anubhava