When running an Apache web server on a Linux system, there may be some directories that you don’t want everyone in the world to be able to access. Apache gives us a couple of different tools that website administrators can use to protect a directory.
One of the most common ways to configure restricted access to a folder is through the .htaccess file. Doing this configuration will prompt users for a password whenever they come across the protected URL. But we can also configure the same protection without .htaccess.
In this guide, we’ll go over the step by step instructions for protecting a directory on an Apache web server, through two different methods. Follow along with us to get the password protection set up on your own website.
In this tutorial you will learn:
- How to protect a directory using .htaccess file
- How to protect a directory without .htaccess file