Protect Directory Folder With .htaccess Auth

Htaccess

Protecting folders is needed to limit users who enter an area and of course many can be used in providing a login system for users. But there is one very easy and very practical way in login system creation, because it only requires 2 files that need to be edited.

In this article I will explain how to protect folders with files .htaccess. On the other hand .htaccess has another algorithm that can save the logged in user as .htpasswd, with proven encrypted passwords are not easy to detect.

The .htaccess file is basically the main brain of a server which allows it to be used to redirect, modify and so on. From each hosting can be described error in editing .htaccess there can be a fatal error that displays the HTTP Code 500 Response. Same as php.ini but the file is still being turned off by the hosting server because it can outwit the server system

Authentic creation in the form of a login that includes a username and password can be well made by other programming languages ​​such as PHP, ASP, Java and so on, so it’s not only .htaccess that can authenticate users, but in practical terms it’s still easy to create with .htaccess. Here’s how to make it.

AuthUserFile /home/user/public_html/.htpasswd
AuthGroupFile /dev/null
AuthName "Private Directory"
AuthType Basic
require valid-user
  1. 1. First copy the code above and pay attention to the /home/user/public_html/.htpassw please change according to the location of the CWD server.

  2. After that paste it in the .htaccess file on the top line so that there is no fatal error.

  3. Then create a file named .htpasswd in the ROOT server, usually in the folder public_html, or www, or html.

  4. Next, please go to the htpasswd creation site at http://htaccesstools.com/htpasswd-generator/ and enter the username and password. Then a textarea will appear and an encrypted username and password will appear, please copy and paste it into the file .htpasswd.

  5. Now please test and see if it can work properly, if a fatal error occurs, please check again on the CWD server that is listed in the .htaccess Authname file whether it is correct or not.

This method can also be used for protect admin login folder like wp-admin to make it safer from the hands of the jail. If you forget the password at any time, it can be generated again on the htaccess tools site as above.

Now, any folder containing important files or pages can be protected in a very practical way, My advice don’t use txt file for htpasswd storage user password because it can be read by search engines. :mrgreen:

Hopefully useful and good luck

Baca Juga:  4 Ways to Overcome MiFi No Signal

Leave a Reply

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