.htaccess - How to redirect requests to files with .xml extension -
on site want block access xml files
for example, when following files requested
http://example.com/a_file.xml
or
http://example.com/some_file.xml
i want browser redirect different page http://example.com/different_page.html
.
here have in .htaccess
far:
setenvif request_uri "\.xml$" blocked rewriteengine on rewritecond %{env:blocked} ^blocked rewriterule (.*) 404.php [r=301]
it not stop it, still can view xml file.
use setenvifnocase directive match against request_uri string in case-insenstive manner :
setenvifnocase request_uri "\.xml$" blocked rewriteengine on rewritecond %{env:blocked} 1 rewriterule ^(.*)$ 404.php [nc,l,r=301]
Comments
Post a Comment