Reputation: 2211
I am developing website in localhost
If the links is
http://localhost:12345/laravel/lala/bank/
it will redirect itself to
http://localhost:12345/bank
but it will work fine without '/'
http://localhost:12345/laravel/lala/bank
i try to configure at routes.php but it seems useless
Upvotes: 0
Views: 1357
Reputation: 25435
Routes aren't the culprit here, it's likely something in your .htaccess. Without seeing it, I guess it's this line (default .htaccess coming in a fresh Laravel install)
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
Judging by your url, looks like you have the project in a subdirectory:
http://localhost:12345/laravel/lala/bank/
Try adding a
RewriteBase /laravel/lala/
in your .htaccess. It should look like this now:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /laravel/lala/
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
It happened to me twice, one I solved it like this, the other I went lazy and just commented that line out (#RewriteRule ^(.*)/$ /$1 [L,R=301]
) :D, both worked.
Upvotes: 3