Last active
August 29, 2015 14:08
-
-
Save kliker/1cb43fa3262338135b9f to your computer and use it in GitHub Desktop.
Keep Drupal log clean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
# Redirect botnet scans to Apache 403 | |
# | |
# WordPress login/admin pages | |
RewriteCond %{REQUEST_URI} ^(.*)/wp-admin$ [OR] | |
RewriteCond %{REQUEST_URI} ^(.*)/wp-login\.php$ [OR] | |
# Drupal pages | |
RewriteCond %{QUERY_STRING} ^q=(node/add|user/register)$ [OR] | |
RewriteCond %{REQUEST_URI} ^(.*)/node/add$ [OR] | |
RewriteCond %{REQUEST_URI} ^(.*)/user/register$ [OR] | |
RewriteCond %{REQUEST_URI} ^(.*)/install\.php$ [OR] | |
RewriteCond %{REQUEST_URI} ^(.*)/update\.php$ [OR] | |
# Joomla! admin pages | |
RewriteCond %{REQUEST_URI} ^(.*)/administrator/(.*)$ [NC,OR] | |
# CKeditor | |
RewriteCond %{REQUEST_URI} ^/kcfinder/(.*)$ [NC,OR] | |
RewriteCond %{REQUEST_URI} ^/ckeditor/(.*)$ [NC,OR] | |
RewriteCond %{REQUEST_URI} ^/fckeditor/(.*)$ [NC,OR] | |
RewriteCond %{REQUEST_URI} ^/administration/(.*)$ [NC,OR] | |
RewriteCond %{REQUEST_URI} ^/admin/fckeditor/(.*)$ [NC,OR] | |
RewriteCond %{REQUEST_URI} ^/manage/(.*)$ [NC,OR] | |
RewriteCond %{REQUEST_URI} ^/editor/(.*)$ [NC,OR] | |
RewriteCond %{REQUEST_URI} ^/includes/(.*)$ [NC,OR] | |
# Other | |
RewriteCond %{REQUEST_URI} ^(.*)admin.php$ | |
RewriteRule ^(.*)$ - [F,L] | |
# Block all txt files except robots.txt | |
<FilesMatch "\.txt$"> | |
Order Allow,Deny | |
Deny from all | |
</FilesMatch> | |
<FilesMatch "robots.txt$"> | |
Order Allow,Deny | |
Allow from all | |
</FilesMatch> | |
# Serve favicon and Safari touch icons[1] from site theme folder | |
# [1] https://mathiasbynens.be/notes/touch-icons | |
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC] | |
RewriteRule ^(favicon\.ico|apple-touch-icon.*\.png)$ /sites/all/themes/name/img/browser-icons/$1 [R=301,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment