Thread: 301 Redirect
View Single Post
  #11 (permalink)  
Old 12-21-2007, 04:17 PM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,661
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: 301 Redirect

Jean-Luc, just to make sure I am reading your rules correctly:

RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ #you are testing for the proper domain
RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [L,R=301] #You are sending the user to the correct domain
RewriteRule ^f\/ - [L] #If the user is already in the f folder, you stop redirecting
RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [L,R=301] #Otherwise you send the user to the f directory

If that is correct, I see a potential problem. If somehow the www. gets dropped from an otherwise valid link, the user will get an extra /f/ directory. In other words, a request to domain.com/f/page.html would redirect to www.domain.com/f/f/page.html. I would remove the /f from the second line, separate detection of the subdomain from detection of the folder.
__________________
The best way to learn anything, is to question everything.
Reply With Quote