Jump to content

Domain and Sub-Domain robots help


UQ13A

Recommended Posts

Hi, I currently have two websites each with different hosts. www.websiteA.com and www.websiteB.com .

 

WebsiteB's content is hosted on websiteA as a subdomain (www.B.websiteA.com) When you visit websiteB.com it redirects to B.websiteA.com.

 

How would i get google to show search results for websiteB, not www.B.websiteA.com

 

Thank You

Link to comment
https://forums.phpfreaks.com/topic/262883-domain-and-sub-domain-robots-help/
Share on other sites

Just drop this in an .htaccess file in the subdomain's root:

 

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} !www.websiteB.com$ [NC]

RewriteRule ^(.*)$ http://www.websiteB.com/$1 [L,R=301]

 

Edit: actually, come to think of it, you probably already have a rewrite rule somewhere else... eliminate that one first, or you'll get a redirect loop

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.