One of our Pro support members was having trouble getting into the admin section of his website. He was getting a 404 error. No recent changes had been made to the site and it was working fine a few days ago.
We debugged the issue for him and it ended up being an issue with an Apache update and an incompatible htaccess/htpasswd rule. This tutorial will show you the fix.
First off, I disabled the .htaccess file and checked the admin. It indeed worked after disabling the file. The last edit on the file was months ago, so nothing had changed for it recently. The htpasswd file also hadn’t been changed in months.
Then I double checked the paths and those were all OK. Since nothing had changed, I suspected that it was a server issue of some kind.
It problem ended up being an Apache update and the new Apache version wasn’t compatible with legacy htaccess rules. It needed the following:
ErrorDocument 401 "Authorisation Required"
AuthType Basic AuthName "Secured Area" AuthUserFile "path/to/passwd" require valid-user
AuthType Basic AuthName "Secured Area" AuthUserFile "path/to/passwd" require valid-user ErrorDocument 401 "Authorisation Required"
What is that line doing? It’s declaring the page to have a HTTP 401 error with a custom message of “Authorisation Required”. The 401 error is required by Apache to trigger the htpasswd file.
I hope this tutorial gets you out of a jam!