Webmasters often overlook security when it comes to their WordPress blogs. After all, WordPress is an excellent piece of software and most blogs are not hacked. However, before you get too comfortable in vulnerable bliss, we suggest that you take the following steps to make your website more secure.
Probably the most important way to prevent attacks is to limit access the the WordPress admin directory. This can be done in one of two ways:
Option 1: Limit access by IP Address
Create an .htaccess file in your wp-admin directory. Next, determine your IP adderss. (You can figure this out by visiting WhatIsMyIPAddress.com.) Next, put the following code in the .htaccess file.
<Limit GET POST PUT>
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx
</Limit>
To allow multiple IP addresses, simply add a new allow line for each allowed IP address.
Option 2: Password Protect the wp-admin Directory
If you have a dynamic IP address or plan to work on your website from multiple locations, limiting access by IP address is probably not the way to go. As an alternative, you can password protect the admin directory.
To create password-protection for this directory, you will need two files: an .htaccess file and a .htpasswd file. And for best results, the .htpasswd file should be placed in a directory not accessible via the web. Additionally, your password should be encrypted. To facilitate the creation of these files, we suggest using the .htaccess file generator and .htpasswd files generator from htaccesstools.com.
By default, all WordPress installs have an an administrator with the admin username. Instead, create a new administrator account and delete the default account.
It is also good practice to hide your directory structure. By default, many WordPress installations enable any visitors to snoop and see all files in folders lacking an index file. And while this might not seem dangerous, it really is. By enabling visitors to see what files are in each directory, they can better plot their attack.
To fix this problem, you can do one of two things:
Option 1: Use An Index File
For each directory that you want to protect, simply add an index file. A simple index.html file will suffice.
Option 2: Use An .htaccess File
The preferred way of hiding the directory structure is to use the following code in an .htaccess file.
Options -indexes
With every new release, there have been notable security fixes which are disclosed to the WordPress community. If you don’t upgrade, hackers will be able to easily exploit your websites from known vulnerabilities.
More often than not, disabled plugins are left in the plugin directory. Unfortunately, this can be a security risk. So, be sure to remove any disabled or unnecessary plugins.
By default, the database tables that hold WordPress data have the prefix wp_. This means that if a hacker attacks your website, they will be more easily able to access all tables because they will know the table names. To prevent this from happening, you should choose a unique table prefix.
For a new installation, simply edit the wp-config.php file as shown below:
$table_prefix = 'youruniqueprefix_';
If you would like to update an already existing WordPress installation, you will need to update the wp-config.php file as shown above in addition to renaming all WordPress database tables. This can be done via PHPMyAdmin or some similar web interface that inables you to update your databases.
Some other ways to secure your blog include:
If you have any additional suggestions for blog security, feel free to share.
Tags: open source, security, software, WordPressTrackback URL for this entry:
http://www.velvetblues.com/web-development-blog/dont-get-hacked-6-ways-to-secure-your-wordpress-blog/trackback/
Contact us today for a quote. Click here to submit details regarding your project.
If you are making a general inquiry, send an email to info@velvetblues.com
Shirley
I heard rough stories about sites being hacked. Not fun, but I find that if people keep updated they shouldn’t run into many issues. However, the areas mentioned in this post are helpful. I’m never heard of the plugin Secure wordpress? Thanks I’m checking it out now. I’ll stumble, review and bookmark. Extremely useful.
-Mig
Yeh, I have personally rescued two people from hacked WP installs, both of which could have been prevented by opting for an upgrade or by hiding the version number….
Thanks for visiting Miguel.
I got hacked, and it wasn’t fun. Perhaps I should have known about these security measures.
Great tips. Thanks.
Shirley, I am impressed. I always keep my wordpress up to date, love version 2.7, but you have brought up some interesting points that I will take under advisement to further safe guard my blogs from hackers.
@Sire, Yes, 2.7 is pretty great. Thanks for stopping by.
And yes, hackers are always one step ahead, so its good to take all possible precautions, even when the blog software is up to date.