You need to block the subdomain using the robots.txt file, which is located at the same directory level
I have one problem
I have a domain name, for example www.testing.com
and new.testing.com
so I don't want to show new.testing.com on any search engine. I added one robots.txt file to new.testing.com. And both sites have the same parent directory
--httpdoc
----testing.com
----new.testing.com
So, I want to know that I can handle both sites using the same robots.txt from test.com, is this possible.
Please suggest me a solution if possible.
+3
Jalpesh
source
to share
2 answers
The best you can do is add separate robots.txt files. Place one in each directory. You must have
- test.com/robots.txt and
- new.testing.com/robots.txt
After adding the robots.txt file to new.testing.com, you must add the following code to keep search engines out.
User-agent: *
Disallow: /
+7
bmiljevic
source
to share
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain.website.com$
RewriteRule ^robots\.txt$ robots-subdomain.txt
Then add the following to / robots -subdomain.txt:
User-agent: *
Disallow: /
+3
DD.
source
to share