1

I had applied 'redirect 301' from main domain to subdomain and Google had indexed sumbdomain (and links under it) for years. Now, for some reason Google has started indexing the main domain while keeping all of subdomain links indexed except one - subdomain.maindomain.com (this one has been de-indexed and replaced by maindomain.com). Main domain shouldn't even be listed in Google results and subdomain.maindomain.com should remain there. There are about 12 results like maindomain.com/folder listed in Google results as of now, I'd like them removed but without using robots (read somewhere it's bad for SEO if combined with 301 redirect?) or requesting removal in Google Webmasters Tools (I'm worried Google will de-index whole site).

Following is the .htaccess config for reference:

RewriteEngine on


AddHandler application/x-httpd-php54s .php

RewriteCond %{HTTP_HOST} ^website\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.website\.com$
RewriteRule ^/?$ "http\:\/\/subdomain\.website\.com\/" [R=301,L]

There's no robots file as of now.

2 Answers 2

1

It looks like you are only redirecting the home page. Your rewrite rule states that for the redirect to work, the path of the URL may only contain an optional slash.

So, if Googlebot somehow gets links deeper into the site, it would be able to crawl the site except for the home page.

You should change your rewrite rule to the following:

RewriteRule ^(.*)$ http://subdomain.website.com$1 [R=301,L]
2
  • Thanks, but it doesn't seem redirecting to sumbdomain?
    – Nix
    Commented Jul 11, 2013 at 19:13
  • Right, I had a bug. I edited it to corrected the rule. Commented Jul 11, 2013 at 19:15
0

I found this website to test: http://htaccess.madewithlove.be/

Then I create a test

.htaccess

RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^(.*)$ http://sub.domain.com/$1 [R=301,L]

Urls tested:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.