Securing WordPress using a combination of configuration changes and plugins.
1. Add keys to wp-config.php
<Files .htaccess wp-config.php>
order allow,deny
deny from all
</Files>
<?php
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . '../path/to/wp-config.php');
define('DISALLOW_FILE_EDIT', true);
# Block wp-includes folder 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>
RewriteCond %{QUERY_STRING} author=d
RewriteRule ^ /? [L,R=301]
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%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]
# Kill PHP Execution
<Files *.php>
deny from all
</Files>
<files xmlrpc.php>
order allow,deny
deny from all
</files>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin(\/)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin/$
RewriteCond %{REMOTE_ADDR} !^63\.224\.182\.124$
RewriteCond %{REMOTE_ADDR} !^96\.81\.205\.229$
RewriteRule ^(.*)$ - [R=403,L]
</IfModule>