cancel
Showing results for 
Search instead for 
Did you mean: 

login with .htaccess

Newbie
Posts: 6
Registered: ‎10-08-2007

login with .htaccess

Please, can anyone help me?
I have created a password protected folder, but when I put its url into my browser I get the message
<Forbidden
You don't have permission to access /protected2 on this server.>
But there is nowhere where the name and password can be entered.
<This is my file .htaccess:
AuthUserFile/share/isp/free-online/http://www/du/dunbarharbour/htdocs/spages/sillittopages/protected2/.htpasswd
AuthName "Please Log On"
AuthType Basic
require valid-user>
What have I done wrong?
8 REPLIES 8
Newbie
Posts: 1
Registered: ‎13-01-2008

Re: login with .htaccess

Hi youn need to create a file called .htpasswd and put this in the protected folder as well.
The file should just contain a line with a user name and a pass word in it ie
David:caravan
Ther's a tutorial at
http://usertools.plus.net/tutorials/id/5
Regards glencot
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: login with .htaccess

Add a space after the AuthUserFile and remove the http://www bit.
You also need to create a populate a .htpasswd file (which the AthUserFile is refering to) with a login and encrypted pasword. The tutorial linked above explains this except replace any reference of plusnet in any file paths to free-online
Newbie
Posts: 6
Registered: ‎10-08-2007

Re: login with .htaccess

Quote from: glencot
Hi youn need to create a file called .htpasswd and put this in the protected folder as well.
The file should just contain a line with a user name and a pass word in it ie
David:caravan
Regards glencot

Thanks, Glencot, I had already done that Sad
Quote from: Peter
Add a space after the AuthUserFile and remove the http://www bit.
You also need to create a populate a .htpasswd file (which the AthUserFile is refering to) with a login and encrypted pasword. The tutorial linked above explains this except replace any reference of plusnet in any file paths to free-online

Thanks, Peter.
I've now tried that, but still no luck, not even if I put the /www back as shown in the tutorial Sad Sad
I'm going to try deleting the protected folder and starting again Roll_eyes
Well, I got the login form now, but my browser evidently can't deal with sending the data Angry  Ah, weel Smiley
Moderator
Moderator
Posts: 30,081
Thanks: 3,183
Fixes: 488
Registered: ‎14-04-2007

Re: login with .htaccess

If you get it to work let me know.
I've just tried every permutation I can think of and still it won't let me in.
Never had any success with it.....401's every time Angry

Customer and Forum Moderator. Windows 10 Firefox 84.0.2 (64-bit)

Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: login with .htaccess

First Linux is case sensitive when it comes to directory and filenames so make sure all directories are lowercase and try not to use any spaces. This is where many people trip up whe they are used to windows which is case insensitive.
.htaccess should look like this

AuthUserFile /share/isp/free-online/www/du/dunbarharbour/htdocs/spages/sillittopages/protected2/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic
require valid-user

This is assuming from your htdocs folder you have the following directories:
spages/sillittopages/protected2/
Try putting a file with content called file.txt in the protected2 directory and checking you can access it with a URL http://www.dunbarharbour/spages/sillittopages/protected2/file.txt
When that works you know you have the path right.
Next create the login & encrypted password to put in the .htpasswd file from http://users.plus.net/htpasswd/ and copy it and the .htaccess file to htdocs/spages/sillittopages/protected2 directory
How are you uploading the .ht* files to your webspace as there can be issues between windows text files and unix text files. It is best to use something like FTP.
Note: This all assumes the change from free-online to plusnet has not changed any paths to your htdocs.
Moderator
Moderator
Posts: 30,081
Thanks: 3,183
Fixes: 488
Registered: ‎14-04-2007

Re: login with .htaccess

*Dick hangs his head in shame*
When I keyed in
AuthUserFile /share/isp/force9/www/xx/username/htdocs/protected/.htpasswd
for the xx I put in the first 2 letters of the protected page login username not my account username Huh
Now it works.
Thanks Peter for demonstrating outstanding patience in the face of absurdity.
*Dick sneaks off to play with his new toy*

Customer and Forum Moderator. Windows 10 Firefox 84.0.2 (64-bit)

Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: login with .htaccess

Grin
Newbie
Posts: 6
Registered: ‎10-08-2007

Re: login with .htaccess

Quote from: Peter
First Linux is case sensitive when it comes to directory and filenames so make sure all directories are lowercase and try not to use any spaces. This is where many people trip up whe they are used to windows which is case insensitive.
.htaccess should look like this

AuthUserFile /share/isp/free-online/www/du/dunbarharbour/htdocs/spages/sillittopages/protected2/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic
require valid-user

This is assuming from your htdocs folder you have the following directories:
spages/sillittopages/protected2/
Try putting a file with content called file.txt in the protected2 directory and checking you can access it with a URL http://www.dunbarharbour/spages/sillittopages/protected2/file.txt
When that works you know you have the path right.
Next create the login & encrypted password to put in the .htpasswd file from http://users.plus.net/htpasswd/ and copy it and the .htaccess file to htdocs/spages/sillittopages/protected2 directory
How are you uploading the .ht* files to your webspace as there can be issues between windows text files and unix text files. It is best to use something like FTP.
Note: This all assumes the change from free-online to plusnet has not changed any paths to your htdocs.

Thanks, Peter. The only part of that which differs from what I did was the <auth/group> line. So I tried it again with that line included, and a newly acquired code for the password file. Again I could get to the request for a password when I clicked on a link to a file in the protected folder, but still the form simply came back twice when I entered the data and then it brought up the 401 message.
Tomorrow I will try starting again absolutely from scratch again. Cry

Still no different. Any other suggestions?