Forum Moderators: phranque
# Set up so that Allows override Denys (required to enable error pages to function)
<FilesMatch ".*">
Order deny,allow
</FilesMatch>
# Ban IP adresses and address ranges here
Deny from #*$!.#*$!.#*$!.#*$!
Deny from #*$!.#*$!.#*$!.#*$!
Deny from #*$!.#*$!.#*$!.#*$!
# Deny many common filetypes except .php
<FilesMatch "\.(inc|tpl|h|ihtml|sql|ini|conf|bin|spd|theme|module)$">
Deny from all
</FilesMatch>
# disable access to config.php and .ht* from a browser
<FilesMatch "^(config\.php|\.ht)">
Deny from all
</FilesMatch>
<FilesMatch "error\.(php|gif)">
Allow from all
</FilesMatch>
## Block Bad Bots by User-Agent
SetEnvIfNoCase User-Agent "Havij" bad_bot
<Files *>
Deny from env=bad_bot
</Files>
The <Directory>, <Files>, and <Location> directives can each use shell-style wildcard characters as in fnmatch from the C standard library. The character "*" matches any sequence of characters, "?" matches any single character, and "[seq]" matches any character in seq. The "/" character will not be matched by any wildcard; it must be specified explicitly.
<FilesMatch (forbidden|goaway)\.html>
Order Allow,Deny
Allow from all
</FilesMatch>
<Files robots.txt>
Order Allow,Deny
Allow from all
</Files> Order Allow,Deny
Allow from all Correct me if I am wrong, but I believe that only the rule in the last container will apply.
the "required to enable error pages to function" reasoning doesn't sound right
# Declare custom error pages
ErrorDocument 400 /error.php
ErrorDocument 401 /error.php
ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
ErrorDocument 500 /error.php
# Set up so that Allows override Denys (required to enable error pages to function)
<FilesMatch ".*">
Order deny,allow
</FilesMatch>
...
<FilesMatch "error\.(php|gif)">
Allow from all
</FilesMatch>