Jump to content


.htaccess trailing slash issue

  • Please log in to reply
1 reply to this topic

#1 fubowl

  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 14 July 2006 - 03:58 AM

I'm trying to add a slash to urls which are typed in without the trailing slash. Of which I'm not the most familiar with .htaccess, but I've been researching for awhile and nothing has merged with my current .htaccess files.

I've also found a strange anomaly with one piece of code I've added. Here is my regular .htaccess code before I've tried to add anything.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

I found this: RewriteRule (.*) http://lthq.local/$1/ [L,R=301]

And added it here:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://lthq.local/$1/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

The anomaly I receive with this is when you type in:
http://test.local/login/foo/bar you are redirected to http://test.local/login/foo/bar////////////////////
Notice the 20 slashes which are added.

So although I got my slash, I got 19 more than was necessary.

Any help would be greatly appreciated.

#2 steelmanronald06

  • Staff Alumni
  • Advanced Member
  • 2,005 posts
  • LocationDallas, TX

Posted 14 July 2006 - 03:37 PM

you could always do:

RewriteRule /forums          /forums/        [R]
RewriteRule /images        /images/      [R]
RewriteRule /includes      /includes/      [R]

So on and so forth.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users