Forum Moderators: phranque
<FilesMatch "\.(php|html?$">
<IfModule mod_headers.c>
Header set X-Robots-Tag "noindex, nofollow"
</IfModule>
</FilesMatch> (?!www.mysite.com\/((index\.php)|(forgot\.php)))(^.*\.(php|html?))$
RewriteRule ^(index|forgot)\.php$ - [E=exclude:1]
<FilesMatch "\.(php|html?)$">
Header set X-Robots-Tag "noindex, nofollow" env=!exclude
</FilesMatch>
[edited by: whitespace at 10:24 pm (utc) on Apr 22, 2015]
example.com/index.php and example.com/forgot.php online correct? Not, example.com/test/index.php?
RewriteRule ^(index|forgot)\.php$ - [E=exclude:1]
SetEnvIf Request_URI (index|forgot)\.php exclude would you not need to prefix the pattern with ^/ to only match files in the document root?
SetEnvIf Request_URI ^/((index|forgot)\.php)?$ exclude it was not working for the index because it would be rewritten to domain.com