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?
- Would hiding a wildcard request from google search console work?
- 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.