htaccess is not working

htaccess is not working

One of many feedbacks for htaccess authenication is that htaccess is not working. Usually this is related to the absolute path to htpasswd file.

htaccess is not working

One of the reasons why htaccess is not working could be related to the absolute path to your website server. Below is the html code in the htaccess file. Notice the absolute path is in red. You must have this correct or otherwise your htaccess will not work.

AuthType Basic
AuthName "Password Required"
AuthUserFile /home#/username/public_html/.htpasswd
Require valid-user

It is essential that you find the absolute path to your account or domain for htaccess authenication to work. You can find the absolute path to your website by viewing the stats column on the main cpanel page of your account. Usually it is in the upper left-hand side of your cpanel.

Let me explain each component of the absolute path, which is in red above.

  • /home#/ - You need to adjust /home#/ to /home/, /home1/ or /home2/ or a different number depending on your home account directory.
  • /username/ - is the username assigned to your web hosting account.
  • /public_html/ - is where your files resides on your server.

If you have an addon domain, it would be as follows:

AuthType Basic
AuthName "Password Required"
AuthUserFile /home#/username/www/domain_name/.htpasswd
Require valid-user




Related Articles

What is the absolute path to my web server?: Don't know your absolute path to your web server? Check this out!





Designed by www.jc-website-designs.com with Adobe Dreamweaver