PDA

View Full Version : Redirecting 2nd URL ?



s2kinteg916
02-23-2007, 06:32 AM
I have two domain names one is plural and the other is singular im trying to redirect the typin for the singular to redirect to the plural domain name? whats the best method for this ? there was a answer to this but i cant seem to find it using search..

Chris
02-23-2007, 06:55 AM
Set up your hosting so that both domains point to the same location, then put this in your .htaccess:



RewriteCond %{HTTP_HOST} ^online-literature.com [NC]
RewriteRule ^(.*)$ http://www.online-literature.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www.theliteraturenetwork.com [NC]
RewriteRule ^(.*)$ http://www.online-literature.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www.literature-web.net [NC]
RewriteRule ^(.*)$ http://www.online-literature.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www.theliteraturenetwork.com [NC]
RewriteRule ^(.*)$ http://www.online-literature.com/$1 [L,R=301]

Or rather, that is the one I use for my literature site, which redirects my 3 domains for that site and the non-www versions of said domains to the main domain.

s2kinteg916
02-23-2007, 10:08 AM
Thanks Chris!!!

s2kinteg916
03-01-2007, 08:46 AM
1. Would this be it "Domain Forwarding redirects or "points" your domain to another location. "

It gives me 2 options 301 or 302 im assuming 301... but just want to clarify.

rpanella
03-01-2007, 11:46 AM
Yes, a 301 is a permanent redirect and 302 is temporary, so for this you would want to use a 301.
________
ASIAN HARDCORE (http://www.****tube.com/categories/128/hardcore/videos/1)

rpanella
03-01-2007, 11:52 AM
Chris, from the htaccess that you posted, it doesn't look like you are actually redirecting the non-www versions of the other names as well. (I just tried http://theliteraturenetwork.com and sure enough it didn't redirect.

You could replace all those lines with this:


RewriteCond %{HTTP_HOST} !^www\.online-literature\.com [NC]
RewriteRule ^(.*)$ http://www.online-literature.com/$1 [L,R=301]

This will take care of all the cases yours currently does as well as the non-www versions that it currently doesn't. The "!" is a negative operator so its bascially saying if the host is not www.online-literature.com then redirect it to that, which is more efficient than checking each other case.
________
BONDAGE HARDCORE (http://www.****tube.com/categories/386/hardcore/videos/1)