.htaccess - htaccess filesmatch(htm|html|php) except two specific files? -
i want automatically add x-robots-tag
header php, htm, html pages except /index.php
, forgot.php
.
this cover of them:
<filesmatch "\.(htm|html|php)$"> <ifmodule mod_headers.c> header set x-robots-tag "noindex, nofollow" </ifmodule> </filesmatch>
but how can exclude /index.php
, /forgot.php
filesmatch
directive?
what want :
valid .htm, .html, .php files
exclude /index.(htm|html|php)
, /forgot.(htm|html|php)
, not */index.php
should valid.
hopefully makes sense... want exclude 2 specific files @ base of site.
update: playing around on tester, still have issues :
(?!.*/(index.php|forgot))(^.*\.(php|htm|html)$)
this excluding urls www.mysite.com/folder/index.php
i looking @ wrong whole time. here using :
# begin noindex,nofollow on login , forgot page <ifmodule mod_env.c> rewriterule ^(index\.php|forgot\.php)$ - [e=exclude:1] <filesmatch "\.(php|html?)$"> <ifmodule mod_headers.c> header set x-robots-tag "noindex, nofollow" env=!exclude </ifmodule> </filesmatch> </ifmodule>
Comments
Post a Comment