I have 2 web sites. First one is "test-www.xxxxxxx.net" and another one is "www.xxxxx.net". I want to make a dynamic no-index meta tag. Google robots can index my live site but I dont want it for my test site. Normaly I may add an attribute and make it dynamic in _Layout.cshtml as below.
@if (!Helper.IsLiveSite())
{
<meta name="robots" content="noindex">
}
Is there a way that I can make it in robot.txt file ? It is written in some articles that "I strongly recommend you use Noindex instead, whenever possible."
So please help! How can I do it in robot.txt. I dont know if the below file will create an error or not.
User-agent: *
Disallow: /styles/
Sitemap: http://xxxxxx/sitemap/sitemap.xml
Noindex: test-www.xxxxxxx.net/*
Noindex: http://test-www.xxxxxxx.net/*
Noindex: https://test-www.xxxxxxx.net/*
Thanks.