Best Web Design & Development Agency Across the Globe!

Blog by iSquare Technologies.

Tips, Tricks & Hacks

Interactive eCommerce | Design | Development Agency / Blog / How to hide OR protect a directory using Htaccess/cPanel?

How to hide OR protect a directory using Htaccess/cPanel?

We are getting same question from most of clients as they want to hide OR protect some folders(mostly admin panel folder) in order to make it more secure and nobody can access that folder with another level of username/password.

If you are a web developer, you might be aware that it’s a very simple thing. But it’s a big task for non-technical persons. So here is the tutorial for how a folder can be protected using htaccess file.

One solution for this is to name the directory with a . then the name so if you have a folder called includes rename it to .includes the folder is still accessible but FTP programs and the like hide folder prefixes with a . then to make it locked down place a .htaccess file inside it and place the following:

deny from all

This will disable access of that folder for everybody. But still files inside the folder can be used inside PHP files by include function.

Another solution for adding a password protection to a particular folder is by using cPanel. Modern cPanel comes up with a option that will make you enable to add a password protection to a folder without writing a single line of code. So how can you do that?

It’s a very simple thing. Login to you cPanel and you will see a folder named “Password Protect Directories” as indicated in below screenshot.

Password_protect

Follow the screen instructions are you are done!

Back to Top
Are you looking for affordable but yet top notch Joomla Services? Check out our Joomla services site