Welcome to WebmasterWorld Guest from 54.163.35.238

Forum Moderators: phranque

Message Too Old, No Replies

Redirect 301 for parked domians causing subdomain problems

     

montenegro

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

10+ Year Member



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

jdMorgan

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

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



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

montenegro

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

10+ Year Member



Jim,

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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month