1

The website I am talking of is not your ordinary website. Our website has multiple subdomain and the website it rendered according to this subdomain. It all runs on a single server which has a wildcard mapping on the load balancer (therefore all subdomain are pointed to the single website). Now the website is rendered according to the subdomain and all of this is in the application logic.

I want to block all subdomain visibility on google search and keep only the results from the main domain.

Could anybody recommend the best and recommend way to handle this without effect SEO for the main domain?

  1. Would hiding a wildcard request from google search console work?

enter image description here

  1. Dynamically render a custom robots.txt based on the request domain file from application logic itself

robots.txt for subdomain

User-agent: *
Disallow: /

robots.txt for main domain

User-agent: *
Disallow:

Or are there any other better methods you can recommend? Thanks.

NOTE: The application is a NextJS application.

1 Answer 1

1

Method one (SC) will probably block all your pages.

Method two (.htaccess for subdomain) is fine. Give it some weeks.

Additionally you could give all your subdomain-pages you want to keep out a <meta name="robots" content="noindex"> within the head.

Your Answer

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

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