Forum Moderators: phranque

Message Too Old, No Replies

Deny from all or RewriteRule?

which is better to disallow access to certain files

         

MickeyRoush

7:08 am on May 8, 2011 (gmt 0)

10+ Year Member



I'm trying to disallow access to two files via htaccess.
1. configuration.php
2. php.ini

I've seen how most would use something like the following:

<Files configuration.php>
Order Deny,Allow
Deny from all
</Files>

<Files php.ini>
Order Deny,Allow
Deny from all
</Files>


Would it be just as good to use RewriteRule?
For example:

RewriteRule ^(configuration\.php|php\.ini)$ - [F]


I appreciate any suggestions.

g1smd

8:10 am on May 8, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I often use RewriteRule and make it the first rule in the list. No point redirecting the request to www then denying it.