I have a vhost with multiple domainnames linked to it. I'm trying to send additional headers when a request is made to one particular domainname.
Here's what I'm doing (tried both in the vhost as in .htaccess, results are the same)
SetEnvIf HOST thishost THETAG=noindex
Header set X-Robots-Tag "%{THETAG}e" env=THETAG
Header set X-Robots-Test "Yes"
So basically, the X-Robots-Test header should always be present. The X-Robots-Tag should only be present if the THETAG header is set, which is only set if the host header contains "thishost".
The RewriteRule looks something like this, so basically a 301 redirect from page1 to page2
RewriteRule page1 page2 [L,R=301]
When a request is made to page2, the headers are show correctly, but when the request is made to page1 (and redirected by mod_rewrite) the headers are not present (not even the test header).
When a redirect is initiated from a PHP script rather than mod_rewrite, it does show the headers so I assume the problem is that mod_rewrite is taking precedence on mod_headers. Is there any way to fix this?