An htaccess header for a specific domain?

I have three environments:

env.com
env-uat.com
env-pre.com

All three pages run the same code. I want env-uat.com and env-pre.com to both get this in htaccess:

Header set X-Robots-Tag "noindex, nofollow"

This will completely remove these pages, including PDF files, etc. But I do not want to influence env.com.

How can I add an X-Robots-Tag header only for env-uat.com and env-pre.com and NOT env.com?

** UPDATE **

From what I could find so far, it would seem that you can only do something like this :

SetEnvIf Request_URI "^/privacy-policy" NOINDEXFOLLOW
Header set X-Robots-Tag "noindex, follow" env=REDIRECT_NOINDEXFOLLOW

But that makes it specific to PAGE. I want it to be specific to DOMAIN.

+4
source share
2 answers

@ Starkin was right here:

SetEnvIf host ^(env-uat\.com|host2\.com)$ NOINDEXFOLLOW

So, you can include the domains that you want to use in this Env, like this:

SetEnvIf host ^(env-uat|env-pre)\.com NOINDEXFOLLOW

Env , :

Header set X-Robots-Tag "noindex, follow" env=NOINDEXFOLLOW

:

Header set X-Robots-Tag "noindex, follow" env=REDIRECT_NOINDEXFOLLOW

Env, REDIRECT_NOINDEXFOLLOW NOINDEXFOLLOW, X Robots Tag noindex specific page   Request_URI .

, :

SetEnvIf host ^(env-uat|env-pre)\.com NOINDEXFOLLOW
Header set X-Robots-Tag "noindex, follow" env=NOINDEXFOLLOW
+3

Host SetEnvIf.

Header X-Robots-Tag (env-uat.com), - :

SetEnvIf host ^env-uat\.com$ NOINDEXFOLLOW
Header set X-Robots-Tag "noindex, follow" env=REDIRECT_NOINDEXFOLLOW

, :

SetEnvIf host ^(env-uat\.com|host2\.com)$ NOINDEXFOLLOW
Header set X-Robots-Tag "noindex, follow" env=REDIRECT_NOINDEXFOLLOW
+2

Source: https://habr.com/ru/post/1694804/


All Articles