Dec
Dec

WordPress Security – Adding Additional Protection to Your Login Page

wordpress-security-smI recently found myself right in the crosshairs of a brute force attack on a couple of my WordPress sites by someone who was adamantly trying to login. I wasn’t really all that worried – I’ve made sure to follow my own advice regarding security.

But it was annoying.

The login attempts were coming from all kinds of different IP addresses, and all kinds of locations, and they kept trying the same set of usernames over and over again. And even though I’ve followed what I believe to be best practices and using security tools like CloudFlare and WordFence the attempts just kept coming.

I’ve got a lot of work to do, and the notifications were steadily flooding my inbox. Hundreds of them. Even though I could simply turn off the notice that the malicious attempt was blocked, that wasn’t enough for me. I wanted it stopped.

As always, there is more than one way to solve the problem, but I wanted something simple that wouldn’t require another plugin.

I found lots of different approaches and methods – like changing the path to the login.php page, various plugins, and restricting access to allow it only from specific IP addresses, among others.

However, I needed something that would enable me to work on my site wherever I have an internet connection, and most of those either weren’t quite what I was looking for, weren’t necessarily the best practice, were too restrictive, or some combination of those things.

private-accessI found this one on the main WordPress site here. This was the perfect solution and it works like a charm.

The thought process here is I want to add another layer of protection by password-protecting the login page. In order to add this additional layer of security to my site I needed to create a new document called .htpasswd.

You can use this tool here to generate the the encrypted password for your .htpasswd file. I’d recommend to create a different username and password than what you normally use for your WordPress login, and don’t use admin as your username for either one.

I created a new file, named it .htpasswd, uploaded it to a non-public directory, which is a different directory than where my .htaccess file lives in the regular web root, and made sure the file permissions were set correctly so there wouldn’t be any security issues.

Once that file was created, there was an addition that needed to be made to my .htaccess to update a couple things and map where it needs to look for the authentication file.

Here is what needs to be added to the .htaccess. (Always make sure you’ve got a backup copy of your file before you make changes.)

# Stop Apache from serving .ht* files
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

# Locking down the wp-login.php page
<Files wp-login.php>
AuthUserFile ~/.htpasswd // this is where you'll need to make sure you've got your path set correctly to your encrypted user password file.
AuthName "Restricted access"
AuthType Basic
require user youruser // this is where you place your separate username to gain access to the login page

</Files>

After you’ve added those changes to your .htpasswd file. Enter your new username and password and then submit. Then once authenticated, you should then be brought to your wp-login.php page where you can enter your WordPress username and password.

The good thing is that the attempts to break in to my sites were never successful, and my site never had any problems at all. Performance was solid before, during and after. Most importantly everything was safe and secure.

There are other options to lock up your WordPress site, but this did the trick for me. The attempts ceased as soon as I implemented this solution. Not a single attempt since.

See Also:

Website Content Is Important – 7 Surprising Pages You Need On Your Website

Mar

"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. "

Keep Reading...

What Pages Do I Need On My Website? 14 Pages Every Website Needs To Have

Mar

"“What pages do I need on my website?” This is the probably the single biggest struggle I see with businesses of all kinds. Planning out what pages you need on your website, what they should say, and how you should say it is vital to your overall online marketing plan. So what pages do you […]"

Keep Reading...

Homepage Web Design: How Do You Design a Good Homepage?

May

"How do you design a good homepage? In order to create the best homepage you can, you have to understand that it’s a little bit “art” and and a little bit “science.” To create the best homepage web design you first have to define your priorities and align them with your target audience. You have […]"

Keep Reading...

Website Marketing & Search Engine Optimization

Sep

"Getting your site built is one thing. Getting your site in front of the right eyes is a completely other thing, so you’ll need to take in to consideration marketing and search engine optimization costs. Search engine optimization, or SEO, is the practice of creating and crafting your site’s copy and structure in such a […]"

Keep Reading...

How to figure out your “who”

Jun

"Knowing who you’re writing for is crucial when you’re going to start a blog. And this part should be easy at this point if you’ve been following along with this series. You know what you want to blog about and you know what your voice and approach is going to be. So now, the people […]"

Keep Reading...

How To Generate Leads For Interior Design in 2021

Jan

"How can you generate leads for your interior design business? Lead generation is the life-blood of any sustainable business. And having a solid, reliable, and proven plan is essential to the process. So if you’re looking for the answer to the question “how to generate leads for interior design”, then you’re in the right place. […]"

Keep Reading...

Website Content Is Important – 7 Surprising Pages You Need On Your Website

Mar

"Website content is important. But that begs the question, “why”? Why is website content so important? Website content is important because it’s the bread and butter of your online business. It’s the one thing that makes everything on your site work together – the design, the architecture, the branding – all of it. So it […]"

Keep Reading...

6 Deadly Pitfalls To Avoid When Choosing Your Domain Name

Sep

"As much as the things we’ve discussed thus far are important, there are also a few things that you will want to avoid when picking your new domain name that are just as important. Don’t pick a domain name that you have to explain I mentioned this previously when discussing the brand name I used […]"

Keep Reading...

The Quick and Dirty Guide to Launching Your Own Website

Sep

"Building your own website is an absolutely essential step all budding entrepreneurs, soloprenuers, bloggers, artists, etc. need to take to build their platform. But you knew that already. What you may not know is that you can do it quickly, relatively painlessly, and be up and running in no time at all. If you’re looking to get […]"

Keep Reading...

ClickFunnels Membership Sites: Your Questions Answered

May

"ClickFunnels membership sites: your questions answered! Building a recurring revenue stream with a membership site can be a critical piece of your online business. It doesn’t matter what kind of membership you want to build – ClickFunnels has some fantastic features that make building a membership site fast and easy. But is ClickFunnels good for […]"

Keep Reading...