Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirecting subdomains to main domain

All with different IPs

12:50 pm on May 6, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 20, 2003
votes: 0


I have these domains:


All with different ips and in the same server. But the first two point (they POINT TO, they are not 301 redirected) to the main site (that is, to the same directory in the server). Like this:

blue.widgets.com ---> serverroot/widgets/
nice.widgets.com ---> serverroot/widgets/
www.widgets.com ---> serverroot/widgets/

Since this situation was poorly managed, I ended up with duplicated sites.

I would like to point each of the first two sites to different directories, and place an htaccess in each directory to 301 REDIRECT each site to the main site. Like this:

blue.widgets ---> serverroot/bluewidgets/(htaccess 301 redir)---> serverroot/widgets/
nice.widgets ---> serverroot/nicewidgets/(htaccess 301 redir)---> serverroot/widgets/

But... I don't know how to do it. Every example I found is very confusing...

Thanks in advance,


12:47 pm on May 7, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 14, 2001
votes: 0

7:04 pm on May 9, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 20, 2003
votes: 0

It seems that is a tough question, or I didn't explain myself correctly...
7:50 pm on May 9, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 9, 2005
votes: 0

Sorry, didn't notice this one went unanswered and domain 'pointing' is not my cup-o-tea.

Since the domains are 'pointed' to your directory, I am assuming they must be subject to the same .htaccess as is present on the main www domain. If this is the case, you should be able to 'bounce' the sub-domain requests to the www version with the following (or, something similar)

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

Consequently, this will redirect any non-www widgets.com requests to www.widgets.com also. If you do not wish for this to happen, you will need to add a second condition.


Contact your host and ask the pointing of the domains be changed to individual sites. After your domains are 'pointed' correctly, you can very simple add a .htaccess file to the sub-domains with the following:

RewriteEngine on
RewriteRule ^(.*)$ http://www.newsite.com/$1 [R=301,L]

There are some detailed explainations of what this does in some other very recent threads, so I will let you decide if you want to know more.

Please note: Since you are rewriting all requests there is no need to set up any directory structure.

Hope this helps.


1:35 am on May 16, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 20, 2003
votes: 0

Thanks Justin!

I have a dedicated server account and can manage where to point domains myself.

I will check both options to see which is best for me.

Thanks again for your reply.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members