transmitstudio
11/3/2016 - 9:55 PM

Add a password-protected directory to a WP site

Add a password-protected directory to a WP site

#first, protect the directory in cpanel

#add this to .htaccess in the password-protected directory if you don't want to allow listings:
# Prevents directory listing
Options -Indexes

#then, in the html root, add this to the .htaccess file:
# Just before #BEGIN WordPress add this:
# To bypass download directory
ErrorDocument 401 /%{REQUEST_URI}/myerror.html
ErrorDocument 403 /%{REQUEST_URI}/myerror.html
# Save the .htaccess file and upload in your root or installation directory.