Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Redirecting subdomains to main domain


jd01 - 7:50 pm on May 9, 2005 (gmt 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.

[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


Thread source:: http://www.webmasterworld.com/apache/3511.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com