Welcome to WebmasterWorld Guest from 23.20.77.100

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

mod rewrite subdomain1 to sundomain2

     
1:15 am on Aug 16, 2010 (gmt 0)

New User

5+ Year Member

joined:Oct 1, 2007
posts: 19
votes: 0


Hi all,

I'd like to redirect any requests from one subdomain to another, basically just replacing the sundomain1 part of the URL with subdomain2

Eg;

If a user tries to access
http://subdomain1.myhost.com/test/page1.php


It will direct them to
http://subdomain2.myhost.com/test/page1.php


Any help would be appreciated.

Thank you
1:04 pm on Aug 16, 2010 (gmt 0)

Full Member

5+ Year Member

joined:Aug 16, 2010
posts:224
votes: 11

Here is an example i use to rewrite *.domain.com to www.domain.com.

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