Welcome to WebmasterWorld Guest from 23.20.8.182

Forum Moderators: phranque

Message Too Old, No Replies

Redirect 301 for parked domians causing subdomain problems

     
1:51 am on Jun 10, 2003 (gmt 0)

New User

10+ Year Member

joined:June 10, 2003
posts:7
votes: 0


Hi,
I have just parked my two newly registered domains on top of my olddomain.com Then I setup 301 redirect for the new domains as per this post [webmasterworld.com...] . The redirect worked fine but my subdomain subdomain.olddomain.com now resolves as olddomain.com/subdomain and that is giving my visitors just a blank page. The code I used to edit my domain's .htaccess is bellow:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST}!^www\.olddomain\.com
RewriteCond %{HTTP_HOST}!^123\.45\.67\.89
RewriteRule ^(.*)$ [olddomain.com...] [R=permanent,L]

I would appreciate your help

5:39 am on June 10, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


montenegro,

Welcome to WebmasterWorld [webmasterworld.com]!

The code is intended to redirect all host names which are not "www.yourdomain.com" to www.yourdomain.com, so I think you're saying it is doing just that. If you wish to exclude "subdomain.oldomain.com" from being redirected, you'll need to add a second RewriteCond as shown.

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.olddomain\.com
RewriteCond %{HTTP_HOST} !^subdomain\.olddomain\.com
RewriteCond %{HTTP_HOST} !^123\.45\.67\.89
RewriteRule ^(.*)$ [olddomain.com...] [R=permanent,L]

An alternative is to rework the code so that only specific hostnames get redirected:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain\.com [OR]
RewriteCond %{HTTP_HOST} ^(www\.)?newdomain\.com [OR]
RewriteCond %{HTTP_HOST} ^(www\.)?newdomain2\.com
RewriteRule ^(.*)$ [olddomain.com...] [R=permanent,L]

Note that the final RewriteCond in your list must not have an [OR] flag on it.

Ref: Introduction to mod_rewrite [webmasterworld.com]

HTH,
Jim

3:00 pm on June 10, 2003 (gmt 0)

New User

10+ Year Member

joined:June 10, 2003
posts:7
votes: 0


Jim,

Thank you very much for the solution. My subdomain is not redirected and new domains' redirects are working fine!