Tech / AI

How to Make a WordPress Site Secure

Online Tech Tips is reader-supported. We may earn a commission when you buy through links on our site. Learn more.

Launching your own WordPress site these days is pretty easy. Unfortunately, it won’t take long for hackers to start targeting your site.

The best way to make a WordPress site secure is to understand every point of vulnerability that comes from running a WordPress site. Then install the appropriate security to block hackers at each of those points.

Table of Contents

    In this article you’ll learn how to better secure your domain, your WordPress login, and the tools and plugins available to secure your WordPress site.

    How to Make a WordPress Site Secure image - How-to-Make-a-WordPress-Site-Secure-1

    Create a Private Domain

    It’s all too easy these days to find an available domain and purchase it at a very cheap price. Most people never purchase any domain addons for their domain. However, one add-on you should always consider is Privacy Protection.

    There are three basic levels of privacy protection with GoDaddy, but these also match offerings of most domain providers.

    • Basic: Hide your name and contact info from the WHOIS directory. This is only available if your government allows you to hide domain contact information.
    • Full: Replace your own information with an alternative email address and contact info to cloak your actual identity.
    • Ultimate: Additional security that blocks malicious domain scanning, and includes website security monitoring for your actual site.

    Usually, upgrading your domain to one of these security levels just requires choosing to upgrade from a dropdown on your domain listing page.

    Create a Private Domain image - domain-protection

    Basic domain protection is fairly cheap (usually around $9.99/yr), and higher levels of security aren’t much more expensive.

    This is an excellent way to stop spammers from scraping your contact info off of the WHOIS database, or others with malicious intent who want to get access to your contact information.

    Hide wp-config.php and .htaccess Files

    When you first install WordPress, you’ll need to include the administrative ID and password for your WordPress SQL database in the wp-config.php file. 

    That data gets encrypted after installation, but you also want to block hackers from being able to edit this file and break your website. To do this, find and edit the .htaccess file on the root folder of your site and add the following code at the bottom of the file.

    # protect wpconfig.php
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>

    To prevent changes to .htaccess itself, add the following to the bottom of the file as well.

    # Protect .htaccess file
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>

    Save the file and exit the file editor.

    Hide wp-config.php and .htaccess Files image - protect-htaccess

    You might also consider right-clicking each file and changing the permissions to remove Write access entirely for everyone.

    Hide wp-config.php and .htaccess Files image 2 - remove-write-access

    While doing this on the wp-config.php file shouldn’t cause any issues, doing it on .htaccess could cause issues. Especially if you’re running any security WordPress plugins that may need to edit the .htaccess file for you.

    If you do receive any errors from WordPress, you can always update permissions to allow Write access on the .htaccess file again.

    Change Your WordPress Login URL

    Since the default login page for every WordPress site is yourdomain/wp-admin.php, hackers will use this URL to try and hack into your site.

    They will do this through what’s known as “brute force” attacks where they’ll send variations of typical usernames and passwords many people commonly use. Hackers hope that they’ll get lucky and land the right combination.

    You can stop these attacks entirely by changing your WordPress login URL to something non-standard.

    There are lots of WordPress plugins to help you do this. One of the most common is WPS Hide Login.

    This plugin adds a section to the General tab under Settings in WordPress.

    Change Your WordPress Login URL image - wps-hide-login

    There, you can type in any login URL you want and select Save Changes to activate it. Next time you want to log into your WordPress site, use this new URL.

    If anyone tries to access your old wp-admin URL, they’ll get redirected to your site’s 404 page.

    Note: If you use a cache plugin, make sure to add your new login URL to the list of sites not to cache. Then make sure to purge the cache before you log back into your WordPress site again.

    Install a WordPress Security Plugin

    There are a lot of WordPress security plugins to choose from. Of all of them, Wordfence is the most commonly downloaded one, for good reason.

    The free version of Wordfence includes a powerful scan engine that looks for backdoor threats, malicious code in your plugins or on your site, MySQL injection threats, and more. It also includes a firewall to block active threats like DDOS attacks. 

    It will also let you stop brute force attacks by limiting login attempts and locking out users who make too many incorrect login attempts.

    Install a WordPress Security Plugin image - brute-force-protection

    There are quite a few settings available in the free version. More than enough to protect small to medium websites from most attacks.

    There is also a useful dashboard page you can review to monitor recent threats and attacks that have been blocked.

    Use the WordPress Password Generator and 2FA

    The last thing you want is for hackers to easily guess your password. Unfortunately, too many people use very simple passwords that are easy to guess. Some examples include using the website name or the user’s own name as part of the password, or not using any special characters.

    If you’ve upgraded to the latest version of WordPress, you have access to powerful password security tools to secure your WordPress site.

    The first step to improve your password security is to go to each user for your site, scroll down to the Account Management section, and select the Generate Password button.

    Use the WordPress Password Generator and 2FA image - wordpress-logins

    This will generate a long, very secure password that includes letters, numbers, and special characters. Save this password somewhere safe, preferably in a document on an external drive that you can disconnect from your computer while you’re online.

    Select Log Out Everywhere Else to make sure all active sessions are closed.

    Finally, if you’ve installed the Wordfence security plugin, you’ll see an Activate 2FA button. Select this to enable two-factor authentication for your user logins.

    If you aren’t using Wordfence, you’ll need to install any of these popular 2FA plugins.

    Other Important Security Considerations

    There are a few more things you can do to fully secure your WordPress site.

    Both the WordPress plugins and the version of WordPress itself should be updated at all times. Hackers often try to exploit vulnerabilities in older versions of code on your site. If you don’t update both of these, you’re leaving your site at risk.

    1. Regularly select Plugins and Installed Plugins in your WordPress admin panel. Review all plugins for a status that says a new version is available.

    Other Important Security Considerations image - wordpress-plugins

    When you do see one that’s out of date, select update now. You may also consider selecting Enable auto-updates for your plugins.

    However, some people are wary of doing this since plugin updates can sometimes break your site or theme. So it’s always a good idea to test plugin updates on a local WordPress test site before enabling them on your live site.

    2. When you log into your WordPress dashboard, you’ll see a notification that WordPress is out of date if you’re running an older version.

    Other Important Security Considerations image 2 - wordpress-update

    Again, backup the site and load it to a local test site on your own PC to test that the WordPress update doesn’t break your site before you update it on your live website.

    3. Take advantage of your web host’s free security features. Most web hosts offer a variety of free security services for the sites you host there. They do this because it not only protects your site, but it keeps the entire server safe. This is especially important when you’re on a shared hosting account where other clients have websites on the same server.

    Other Important Security Considerations image 3 - site-host-security

    These often include free SSL security installs for your site, free backups, the ability to block malicious IP addresses, and even a free site scanner that’ll regularly scan your site for any malicious code or vulnerabilities.

    Running a website is never just as simple as installing WordPress and just posting content. It’s important to make your WordPress website as secure as possible. All of the above tips can help you do so without too much effort.