Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design
Showing posts with label Protect Folder. Show all posts
Showing posts with label Protect Folder. Show all posts

htaccess Password Protect Folder


If you want to protect you directory using htaccess than follow this post.

Protecting files on your website from unauthorized users can be very important. Even more important is the method by which you accomplish this task. You can use PHP to listen for login authorization information on each page, but that doesn't protect your images, documents, and other media. That's why .htaccess method of protecting files and directories the most reliable.

Step1: Creat one .htaccess file as following
AuthName "Authorisation Required"
AuthUserFile "/home/test/public_html/getfile/.htpasswd"
AuthType Basic
require valid-user
ErrorDocument 401 "Authorisation Required"

Step2: Creat one .htpasswd file as following
username:encryptedpassword

The .htpasswd file contains the usernames and passwords of allowed users. One per line. The passwords are MD5'd for security purposes.
e.g. dave:XO5UAT7ceqPvc

That's it.

 

Copyright @ 2017 HKBlog.