Last active
August 18, 2020 05:00
-
-
Save MogulChris/9c75cb53f31a2e236f60764e87067fd6 to your computer and use it in GitHub Desktop.
Password protect a CodeIgniter subdirectory using .htpasswd, avoid 404 errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Using CPanel to password protect a CodeIgniter subdirectory, and getting a 404 error when trying to access the subdirectory? I got u fam. | |
# This goes in the .htaccess file in the directory you wish to protect | |
#The critical line is ErrorDocument 401 "Authorisation Required" | |
#----------------------------------------------------------------cp:ppd | |
# Section managed by cPanel: Password Protected Directories -cp:ppd | |
# - Do not edit this section of the htaccess file! -cp:ppd | |
#----------------------------------------------------------------cp:ppd | |
AuthType Basic | |
AuthName "My extremely secret directory" | |
AuthUserFile "/path/to/.htpasswd" | |
Require valid-user | |
#----------------------------------------------------------------cp:ppd | |
# End section managed by cPanel: Password Protected Directories -cp:ppd | |
#----------------------------------------------------------------cp:ppd | |
#Fixes your 404 issue | |
ErrorDocument 401 "Authorisation Required" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credit where due: https://stackoverflow.com/a/38075858