Mobile app version of vmapp.org
Login or Join
Hamm4606531

: Redirect from non-existent subdomains is correct? Search engines recorded referrals from links like this: http://subdomain1.example.com, http://subdomain2.example.com. Subdomain pages display the contents

@Hamm4606531

Posted in: #CanonicalUrl #Seo #Subdomain

Search engines recorded referrals from links like this: subdomain1.example.com, 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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Hamm4606531

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

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 .* example.com/[CO] [R=301,L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme