0

I have old website and converted it to laravel 4.1; removed cut off trailing slash from htaccess.

The problem is that you can view the page without trailing slash and it is bad as can be abused in future

So I need to either to redirect 301 to page with trailing slash or show 404 how can I do this in elegant way?

nobody
  • 19,814
  • 17
  • 56
  • 77
jsHate
  • 499
  • 1
  • 3
  • 20

2 Answers2

0

I think this might be what you want. It will redirect everything without a trailing slash to the page with a trailing slash.

.htaccess

RewriteRule ^(.*)$ $1/ [R=301,L]
Jimmie Johansson
  • 1,875
  • 1
  • 19
  • 39
  • i found htaccess solution RewriteCond %{REQUEST_URI} !(/$|\.) RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] and it worked – jsHate May 21 '14 at 05:06
0

found here the htaccess method if sm1 interested Add Trailing Slash .htaccess

RewriteCond %{REQUEST_URI} !(/$|\.)

RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] 
Community
  • 1
  • 1
jsHate
  • 499
  • 1
  • 3
  • 20