WordPress and HTTP Basic-Auth
9 Apr
This post is for those of you with the same problem, say thanks to Google!
Problem: With WordPress and permalinks enabled, if you protect a folder or a file with .htpasswd, you’re going to get a nasty 404 Not Found.
Solution: Just add to your .htaccess file the following lines:
ErrorDocument 401 /[path_to_the_file]/myerror.html
ErrorDocument 403 /[path_to_the_file]/myerror.html
When /[path_to_the_file]/myerror.html is an existant static file in the server.
Explanation: Seems like the HTTP Basic-Auth returns a 401 Unauthorized to ask for the password. This got translated into a ErrorDocument directive, and if you haven’t properly set it up in your .htaccess (for example, pointing to some non-existant file), then it will be finally got by WordPress, which will return a 404 error.
Conclusion: Madness is here! I don’t understand how this isn’t better documented. Hope this helps!
Gracias por el dato!!! SabÃa que era algo en el .htaccess de wordpress ya que nada parecÃa funcionar correctamente. Al menos ya terminó esta lucha de apache-wordpress XD Gracias de nuevo.
Jejeje, tu también andabas tirándote de los pelos eh? :D Me alegro que te haya servido.