Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.