The protection of Joomla admin folder returns 404 error
All the websites created with Joomla! CMS or WordPress and occasionally PHP, are always protected at the administrator folder level from cPanel or Plesk. This consists one of the most important rules of our security. Here is an example of how the error can be encountered. Recently, we installed the components Sh404sef and Admin Tools, for SEO and security purposes on a client’s website. However, when the client visited the admin page, e.g. http://www.domain-name.com/administrator/ the page error 404 – page not found occurred.
After the deletion of the .htaccess file from the admin folder, the Joomla Admin Panel worked without any issues and the 404 page error didn’t re-occurred. This proves that the initial error didn’t conflict with sh404 SEF and Joomla Admin Tools, but there was possibly a syntax error in the .htaccess file.
However, we carried out further investigation for this issue and we concluded that an extra line will need to be inserted in the file “/public_html/administrator/.htaccess”. The new entry is as follows: “ErrorDocument 401 “Authorisation Required”. This is a requirement as per Apache standards (Apache is looking for the 401 error document when using .htpasswd, therefore it needs to be explicitly specified in the website’s code).
Please find below the correct syntax for the designated code:
AuthName "Authorisation Required" AuthUserFile "/home/acc/.htpasswds/public_html/administrator/passwd" AuthType Basic require valid-user
AuthName "Authorisation Required" AuthUserFile "/home/acc/.htpasswds/public_html/administrator/passwd" AuthType Basic require valid-user ErrorDocument 401 "Authorisation Required"
If you have any further questions or any difficulties with the suggested solution above, please contact us via the comments form below.