Welcome to WebmasterWorld Guest from 54.144.79.200

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirecting subdomains to main domain

All with different IPs

     

Eugenios

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

10+ Year Member



Hello,

I have these domains:

blue.widgets.com
nice.widgets.com
www.widgets.com

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,

Enrique

eflouret

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

10+ Year Member



Anybody?

Eugenios

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

10+ Year Member



It seems that is a tough question, or I didn't explain myself correctly...

jd01

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

WebmasterWorld Senior Member 10+ Year Member



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.

[OR]

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.

Justin

Eugenios

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

10+ Year Member



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.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month