Search engines recorded referrals from links like this: http://subdomain1.example.com, http://subdomain2.example.com. Subdomain pages display the contents of main domain pages but subdomains do not exist. CMS writes canonical link with subdomain address for subdomain page and with domain address for main domain page.

Is the correct solution for SEO to set 301 redirect from non-existent subdomains on main domain or can I just rewrite href attribute in canonical link before output for subdomain pages?


Setting the correct canonical URL in the link element should be sufficient (although you might need to verify these "non-existent" subdomains in Google Search Console?), however, it would be preferable to set a 301 redirect which will catch users as well and prevent them linking to the wrong domain, etc.

This sort of redirect can be (should be) included as part of your canonical (www / non-www) redirect.

For example, to redirect all requests that are not for your canonical domain (eg. example.com) to your canonical domain then you can do something like the following in your server config, or .htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} !=example.com
RewriteRule .* http://example.com/$0 [R=301,L]
  • I know that these subdomains on the server does not exist. But search engines somewhere finds links with subdomains pointing to different pages of the site. – IvanMalenko Nov 7 '15 at 18:23
  • Setting up a redirect would probably be the only way to resolve these erroneous links being reported. Do you see many different subdomains? Or just a few? You could verify these subdomains in Google Search Console (formerly Webmaster Tools) to find out where these links are coming from. You say you are seeing "referrals" from those subdomains... for which domain are you seeing these referrals?, ie. what is the target? – MrWhite Nov 7 '15 at 18:32
  • I see many different subdomains. More than one hundred. – IvanMalenko Nov 7 '15 at 18:33
  • Do you have any legitimate subdomains? That many erroneous subdomains sounds like a misconfiguration somewhere - unless perhaps subdomains are part of your URL model? – MrWhite Nov 7 '15 at 18:36
  • No. Multiple sites on the same VPS. But there is no subdomain. – IvanMalenko Nov 7 '15 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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