cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New

.htaccess

Hi,

I recently created a webpage that i want to protect with a password. I tried to use .htaccess to protect my index.html site but when i try to access the page, it returns error 401.  Here is the code that i use.

 

AuthUserFile home/mywebsite/public_html/mywebsite.com/webspecial/.htpasswd
AuthType Basic
AuthName "Special Page"

<Files "index.html">
  Require valid-user
</Files>

I hope someone can help me on this.

 

Thank you very much.

3 REPLIES 3
Helper VI
Helper VI

Re: .htaccess

You can use the Password protect directory feature from cPanel, instead of using .htaccess.

I have never seen it being used to login for a file, as in your case, but for directories.

 

Hope it helps!

If you find my replies helpful, give me a like or kudo 🙂
And if I solved your issue, mark it as solution 😄
New

Re: .htaccess

@jpablo I also tried that one at first but the problem is after i put password on it and try accessing the page on the website, instead of a prompt of a password to access the page, it shows 401 error or web page does not exists.

Helper VI
Helper VI

Re: .htaccess

@CMS I have tried to use the password protect feature on cpanel and worked perfect for me.

What I would do, in your case is delete the .htaccess file and the passwd file, and then use the cpanel password protect. Maybe the passwd file you created doesn't work well with cpanel.

Let me know if that helps!

If you find my replies helpful, give me a like or kudo 🙂
And if I solved your issue, mark it as solution 😄