.htaccess password on root not working - .htaccess

i'm trying to apply a site password to the root directory of my site:
www.example.com
I have my .htpasswd file in the same directory as the .htaccess file (public_html) and my .htaccess file has the following code:
AuthType Basic
AuthName "This Area is Password Protected"
AuthUserFile /public_html/.htpasswd
Require valid-user
With this code it prompts for credentials however when I enter the correct credentials it takes me to a server error page. Where have I gone wrong here?

Related

adding .htaccess and .htpasswd files do not restrict access to localhost folder

I have followed the procedure to the letter and it does not work for me.
The procedure: Create file .htaccess which has the following lines of text.
AuthType Basic
AuthName "restricted area"
AuthUserFile "C:/Apache24/htdocs/protected/.htpasswd"
require valid-user
Next create file .htpasswd which has a username and encrypted password created by http://www.htaccesstools.com/htpasswd-generator/
Next I insert both .ht files into the folder named protected, which is in the folder htdocs.
When I type in the browser address window http://localhost/protected/ and hit enter I get Index of protected and the list of files in it. It never asks for username or password.
See summary above.
AuthType Basic
AuthName "restricted area"
AuthUserFile "C:/Apache24/htdocs/protected/.htpasswd"
require valid-user

.htaccess/.htpasswd not working on web host

I have my website setup on a web host. My .htaccess and .htpasswd files are not working. The alert pops up but it keeps asking for the username and password even though I input the correct credentials.
The directory of these files is:
/home8/afmaclub/public_html/Members/.htaccess
/home8/afmaclub/public_html/Members/.htpasswd
The code for the .htaccess and .htpasswd is below:
.htaccess
AuthName "Member\'s Area"
AuthUserFile /home/afmaclub/public_html/Members/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
require valid-user
.htpasswd
Username:Encrypted Password

Adding htaccess and htapassrd to heroku site

I'm trying to temporarily password protect my Heorku app with the .htaccess and .htpasswrd files in the root of the app.
I'm getting a 'Internal Server Error' with the following codes and can't figure out where I'm going wrong
.htaccess
AuthUserFile .htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user
.htpasswrd (MD5 encrypted)
rob:$apr1$MRsSwhFN$buG0YTSOezeY8YJ32LXnT1
Looks like your path is off.
As of July 2016, some subtle changes are necessary on heroku-php-apache2. Please note that the path to the .htpasswd file no longer contains the www directory and that the .htpasswd file should be in the webroot as well.
Create an .htaccess file in the webroot:
AuthUserFile /app/.htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user
Create a .htpasswd file, also in the webroot:
htpasswd -c .htpasswd [username]
Commit local changes. Deploy to Heroku.
https://gist.github.com/bbrewer97202/3316425

htpasswd protecting wrong directory

I setup htaccess in combination with htpasswd to protect only two subdirectories of the root directory and at first it worked fine but suddenly it's asking for a username and password at the root directory (aka homepage website).
My tree view:`
/website (root)
/cms
/crm
/email
Now I protected the CMS and CRM directories with htaccess and htpasswd which worked fine until now.
.htpasswd file:
user:hashed_pass
.htaccess file:
AuthName "Welcome/auth text"
AuthUserFile /path/to/.htpasswd
AuthType Basic
require valid-user

htaccess file protecting but no pass prompt

Hi I have the following in a .htaccess file:
AuthType Basic
AuthName "restricted area"
AuthUserFile /web/clients/.htpasswd
require valid-user
this works in making the directory private, however I get a 403 error and no password/user pop up appears to even give me the chance? Any ideas as to what I am doing wrong, both htaccess and htpasswd are together in the directory I want to protect.
Thanks

Resources