Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ########## Begin - Rewrite rules to block out some common exploits
- ## If you experience problems on your site block out the operations listed below
- ## This attempts to block the most common type of exploit `attempts` to Joomla!
- #
- # Block out any script trying to set a mosConfig value through the URL
- RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
- # Block out any script trying to base64_encode crap to send via URL
- RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
- # Block out any script that includes a <sc ript> tag in URL
- RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
- # Block out any script trying to set a PHP GLOBALS variable via URL
- RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
- # Block out any script trying to modify a _REQUEST variable via URL
- RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
- # Send all blocked request to homepage with 403 Forbidden error!
- RewriteRule ^(.*)$ index.php [F,L]
- #
- ########## End - Rewrite rules to block out some common exploits
- <files wp-config.php>
- order allow,deny
- deny from all
- </files>
- <files ~ "^.*\.([Hh][Tt][Aa])">
- order allow,deny
- deny from all
- satisfy all
- </files>
- # Turn off Index wp-includes
- Options -Indexes
- # Block WordPress xmlrpc.php requests
- <Files xmlrpc.php>
- order deny,allow
- deny from all
- </Files>
- # Blocks some XSS attacks
- <IfModule mod_rewrite.c>
- RewriteCond %{QUERY_STRING} (\|%3E) [NC,OR]
- RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
- RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
- RewriteRule .* index.php [F,L]
- </IfModule>
- # Blocks all wp-includes folders and files
- <IfModule mod_rewrite.c>
- RewriteEngine On
- RewriteBase /
- RewriteRule ^wp-admin/includes/ - [F,L]
- RewriteRule !^wp-includes/ - [S=3]
- RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
- RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
- RewriteRule ^wp-includes/theme-compat/ - [F,L]
- </IfModule>
- # Restricts access to PHP files from plugin and theme directories
- RewriteCond %{REQUEST_URI} !^/wp-content/plugins/file/to/exclude\.php
- RewriteCond %{REQUEST_URI} !^/wp-content/plugins/directory/to/exclude/
- RewriteRule wp-content/plugins/(.*\.php)$ - [R=404,L]
- RewriteCond %{REQUEST_URI} !^/wp-content/themes/file/to/exclude\.php
- RewriteCond %{REQUEST_URI} !^/wp-content/themes/directory/to/exclude/
- RewriteRule wp-content/themes/(.*\.php)$ - [R=404,L]
- # BEGIN block author scans
- RewriteEngine On
- RewriteBase /
- RewriteCond %{QUERY_STRING} (author=\d+) [NC]
- RewriteRule .* - [F]
- # END block author scans
- #disable hotlinking of images with forbidden or custom image option
- RewriteEngine on
- RewriteCond %{HTTP_REFERER} !^$
- RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?<your website> [NC]
- RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
- RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
- # Custom page
- ErrorDocument 404 /404.html
- ErrorDocument 403 /403.html
- ErrorDocument 500 /500.html
- ErrorDocument 501 /501.html
- # deny access to evil robots site rippers offline browsers and other nasty scum
- RewriteBase /
- RewriteCond %{HTTP_USER_AGENT} ^Anarchie [OR]
- RewriteCond %{HTTP_USER_AGENT} ^ASPSeek [OR]
- RewriteCond %{HTTP_USER_AGENT} ^attach [OR]
- RewriteCond %{HTTP_USER_AGENT} ^autoemailspider [OR]
- RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
- RewriteCond %{HTTP_USER_AGENT} ^Xenu [OR]
- RewriteCond %{HTTP_USER_AGENT} ^Zeus.*Webster [OR]
- RewriteCond %{HTTP_USER_AGENT} ^Zeus
- RewriteRule ^.* - [F,L]
- <Files *.php>
- Order allow,deny
- Deny from all
- </Files>
Add Comment
Please, Sign In to add comment