This article describes several ways to enhance the security of your WordPress site.
There are several essential steps you should take to enhance the security of a WordPress site:
Use a strong password for all administrator accounts, and change passwords periodically. Strong passwords are not easily guessed. To break into an account with stong passwords, hackers use a brute force attack. Stopping brute force attacks is covered below.
If your site has been compromised (or you even suspect that it has been compromised), you must also change the security keys in the wp-config.php file that are used to encrypt cookies. Simply changing passwords is not enough, because an attacker may still have a valid cookie and be able to access your site.
For more information about how to configure security keys in the wp-config.php file, please visit http://codex.wordpress.org/Editing_wp-config.php#Security_Keys.
Do not use the default admin username for the adminstrator. Instead, create a user with a different username, assign the administrative role to it, and then delete the default admin administrator.
WordPress is updated regularly to address known vulnerabilities. Running old versions of WordPress makes it easy for hackers to gain access to your site. Run updates regularly to make sure WordPress and all related plugins are up to date. For more information about how to update WordPress, please see this article.
Even though unused plugins and themes are disabled, that code is still visible on the Internet and can be a target for hackers. Be sure to delete any unused themes or plugins in order to reduce the opportunity for hackers to gain access to your site.
Make regular backups of your WordPress site. Backups will not prevent a site from being compromised but they do help get a site back online quickly in case of compromise. You can use Softaculous to back up, restore, and update your WordPress site from one convenient interface. For more information about how to do this, please see this article.
A brute force attack is a simplistic type of attack where a user or script tries to gain access to a site by repeatedly guessing different username and password combinations. Unfortunately, many people have username and password combinations that are easily guessed, so brute force attacks are often effective.
If your WordPress site experiences a brute force attack, you may notice that the site responds slowly, or not at all. Additionally, you may be unable to log in. This is because the flood of login attempts during a brute force attack causes numerous PHP and MySQL calls. These calls increase server load and adversely affect website performance.
There are several measures you can take to defend against brute force attacks on your site:
WordPress uses the wp-login.php file for logins. By adding password protection to this file, you add another layer of security to your site. Users must enter a username and password before they can even access the wp-login.php file to log in to WordPress.
To set up password protection for the WordPress login page, follow these steps:
username:$apr1$IUQgDA6U$qbXb9wEnjirNCqxezpjoe5
Create a file named .wp-password in your A2 Hosting account's home directory (/home/username, where username represents your A2 Hosting account username). Paste the line of text from the previous step into the file. There are two ways you can create and edit this file:
Create an .htaccess file in the directory where you installed WordPress:
Copy and paste the following text into the .htaccess file:
# Prevent Apache from serving .ht* files: <FilesMatch "^\.ht"> Order allow,deny Deny from all </FilesMatch> ErrorDocument 401 "401 Unauthorized" ErrorDocument 403 "403 Forbidden" # Protect wp-login.php: <Files wp-login.php> AuthUserFile /home/A2-USERNAME/.wp-password AuthName "Please log in" AuthType Basic require user WP-USERNAME </Files>
In the .htaccess file, make the following changes:
Another way to counter brute force attacks is by blocking IP addresses. With this configuration, you can allow one (or several) IP addresses to access the WordPress login page, and block everything else.
To prevent IP addresses from accessing the login page, follow these steps:
Copy and paste the following text into the .htaccess file:
<Files wp-login.php> order deny,allow allow from xxx.xxx.xxx.xxx deny from all </Files>
In the .htaccess file, replace xxx.xxx.xxx.xxx with the IP address that you want to allow for WordPress logins. All other IP addresses will be blocked from accessing the wp-login.php page.
The default WordPress login page is wp-login.php, and a basic WordPress installation does not allow you to change this location. However, the Rename wp-login.php plugin allows you to change the WordPress login URL. Doing so can reduce the impact of brute force attacks, which are usually scripts that are programmed to hit the wp-login.php page over and over again with login attempts.
When you change the WordPress login URL, anyone who tries to access the wp-login.php page or wp-admin directory receives a “404 Not Found” error message.
To change the WordPress login URL, follow these steps:
Cloudflare is a content delivery network (CDN) that can block malicious requests before they reach your site. For example, Cloudflare-enabled sites were significantly protected during a large-scale WordPress brute force attack that occurred in April 2013.
Cloudflare works by routing traffic to your website through its own network. As a result, Cloudflare is able to block certain types of malicious requests. Cloudflare also increases website performance by leveraging its worldwide server network to deliver content to users more efficiently.
For general information about Cloudflare, please see these articles. For instructions about how to enable Cloudflare for your site, please see this article.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.