404 Error When Using a URL With a Shared Server SSL

If you are accessing a password-protected directory with a URL that includes the use of a shared server SSL (https://securexxx.hostgator.com/~<user>/<whatever>) and receiving a 404 error, this is because Apache is looking for a 401 page and serving a 404 when it is not found.

To resolve this, add a single line to the .htaccess file in the protected directory to give Apache the 401 pages it is looking for (ErrorDocument 401 Authorization Required).

For information on how to add this line to your .haccess file, please read:

Example

In the following code, please be sure to replace yourusername with your actual cPanel username, and also be sure the gator123 is replaced with your actual server number. This information can be found in your Welcome Email as well as on the left navigation menu in your cPanel.Before Fix:

[root@gator123 /home/yourusername/www/home]# more .htaccess.old
AuthType Basic
AuthName "home"
AuthUserFile "/home/yourusername/.htpasswds/public_html/home/passwd"
require valid-user 

After Fix:

[root@gator123 /home/yourusername/www/home]# more .htaccess
AuthType Basic
AuthName "home"
AuthUserFile "/home/yourusername/.htpasswds/public_html/home/passwd"
require valid-user
ErrorDocument 401 "Authorization Required"

Was this article helpful?

Related Articles