homepage Welcome to WebmasterWorld Guest from 54.204.231.253
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque & physics

Webmaster General Forum

    
Redirect 301 for parked domians causing subdomain problems
montenegro




msg:388275
 1:51 am on Jun 10, 2003 (gmt 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

 

jdMorgan




msg:388276
 5:39 am on Jun 10, 2003 (gmt 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

montenegro




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

Jim,

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved