Protect Your Admin Folder in WordPress Using the .htaccess File

Protect your admin folder in WordPress using the .htaccess file

The security of your blog comes at the top because you should know that many websites get hacked. For more security, you can protect your admin folder in WordPress using the .htaccess file.

The concept of using the .htaccess file is here to limit the IP address using which, you can log in.

Every user has a different IP of his/her internet connect. But if you allow only your IP address to login to your admin panel, it can be secured.

Though many people password protect the admin directory but if you want more protection, you can add a few lines of the code in the .htaccess file.

Allow Only Those IPs Which You, Your Co-authors Use

If you’re running your blog alone then it can be really simple to allow only one IP. Though many people work from their home and the office.

Well, for that, you can add multiple IP addresses to the list. People with these IPs can access the admin panel of your blog.

To do so, you have to edit the .htaccess file.

If you’re using the Yoast SEO plugin then you can edit this file from your admin panel only. But if you’re using any other plugin like All In One SEO plugin or the frameworks like Thesis then you have to use the cPanel.

From the Yoast SEO plugin, go to SEO>>Tools>>File Editor.

On this page, you can easily see the .htaccess file.

#Limit Login Only For One IP
order deny,allow
deny from all
allow from

Add this code in this file and save.

NOTE: Don’t forget to replace the IP address with your own.

For multiple IPs, you can add another line in this code.

#Limit Login Only For Multiple IPs
order deny,allow
deny from all
allow from
allow from

This code includes two IP addresses. Just like above, you can add as many IP addresses you want.

Save the file and you’re all set. Just after a few minutes, if you try to login to your WordPress website from a different IP, you wouldn’t able to do so.

NOTE: This method is beneficial only if you run your blog with limited IP addresses.

If you’re having a membership website then it’s impossible to add all the IPs. It’s because not everyone uses only one IP.

Suppose if you’re traveling and working, you may want to add more and more IP addresses because of the change in the network.

There are many people who use the dynamic IP addresses.

But you’re a person who handles his own blog from home with a wi-fi connection having a single IP then it’s one of the best ways to protect your admin folder in WordPress using the .htaccess file.

It will help you block the fake login attempts. You may have read about the brute force attack.

I Hope You Can easily Protect Your Admin Folder in WordPress Using the .htaccess File

Most of the people get scared when it comes to such technicalĀ things. But once you learn about the benefits, you will never complain.

You should always look for the better options when it comes to the WordPress security. There are many WordPress security tips which can help you.

After reading the concept, do you still want to protect your admin folder in WordPress using the .htaccess file?

Depending on your working choice, you can come to the right decision. If you have any doubt, feel free to drop a comment.

You can also connect with us on Twitter, LinkedIn, and Facebook.

by Ravi Chahar

A WordPress Professional and the LinkedIn Influencer. A coder by passion and a blogger by choice. WordPress theme development is his forte. He is your WordPress guy who will teach you how to solve WordPress errors, WordPress security issues, design issues and what not.

Get Free Updates Into Your Inbox

Learn Everything Just Like I Did


Leave a Reply

Your email address will not be published. Required fields are marked *