htpasswd protecting wrong directory - .htaccess

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

Related

.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

.htaccess password on root not working

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?

Password protection via .htaccess working in subdirectory but not in subdomain

I have a main site and a subdomain test site.
On the main site I have a folder previously used for testing...
/httpdocs/test/
Within that I have a htaccess file
AuthUserFile /var/www/vhosts/myurl.com/private/.htpasswd
AuthType Basic
AuthName "Login"
Require valid-user
And an associated .htpasswd in the location specified. This works perfectly.
However, using exactly the same .htaccess for my new subdomain does not work
i.e. putting the .htaccess file at
/subdomains/tests/httpdocs/
or any subdirectory.
Any suggestions why this might be? I get the login screen but it won't accept any correct username/password.
Thanks,
Nick

How to allows access to a folder with htaccess

I have an htaccess to prevent access to a folder.
Howerver, I would like to one subfolder is allowed to be accessed.
Here is my htaccess file. How can I modifiy it to
AuthName "Private Zone"
AuthType Basic
AuthUserFile /vdir/www.web.net/var/www/vhosts/www.web.net/web/folder/.htpasswd
require valid-user
Here is the folder that I want to be not protected
/vdir/www.web.net/var/www/vhosts/www.web.net/web/folder/go/upload/
How can I do this?
Try to create a .htaccess file under ../go/upload/ with the following content:
AuthType None
Require all granted

Resources