.htaccess to deny access to most xml files

Posted by CEich on Server Fault See other posts from Server Fault or by CEich
Published on 2010-07-29T10:32:00Z Indexed on 2011/02/06 7:28 UTC
Read the original article Hit count: 512

Filed under:
|
|

I recently had a Joomla site hacked, so I'm trying to harden the site a bit. There's a section in the recommended .htaccess that restricts outside access to the xml files that come with extensions. However, it also keeps my sitemap.xml file from being accessed.

How do I allow a certain file whiles keeping the rest?

here's the default code:

<Files ~ "\.xml$">
 Order allow,deny
 Deny from all
 Satisfy all
</Files>

and my modification that caused a 500 error:

<Files ~ "(?!sitemap)\.xml$">
 Order allow,deny
 Deny from all
 Satisfy all
</Files>

© Server Fault or respective owner

Related posts about security

Related posts about .htaccess