0

Running apache 1.3 (don't ask) Need to redirect mydomain.com/bla to mydomain.com/bla/ (note the slash)

I think this rewrite is writing it to the wrong place.

RewriteRule ^([^\.]+)/?$          index.php?page=$1&%{QUERY_STRING} [L]

I have tried to ignore it but this hasn't worked.

RewriteCond %{REQUEST_URI} !^/bla
RewriteRule ...
Shane Madden
  • 114,520
  • 13
  • 181
  • 251
Benbob
  • 277
  • 1
  • 6
  • 19

1 Answers1

1

Your explanation is a bit confusing, but is it the trailing slash you want to add to every directory URL? So /bla becomes /bla/ and /files becomes /files/ and so on? You can do that with this mod_write configuration:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.mydomain.com/$1/ [R=301,L]

The second line excludes all (existing) regular files, the third line excludes all URL's which already have a trailing slash and the last line tells mod_rewrite to redirect the visitor to the specified domain followed by the original path, but now with a trailing slash.

PowerSp00n
  • 1,506
  • 1
  • 8
  • 8