Wordpress and HTTP Basic-Auth

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!

Compártelo
April 9th, 2007 | Development, English, Web |

2 comments

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.

Comment by j_aroche — 24-04-2007 @ 23:59

Jejeje, tu también andabas tirándote de los pelos eh? :D Me alegro que te haya servido.

Comment by Kr0n — 25-04-2007 @ 8:18

Categories

Syndication

my favorite pictures

    Archives

    Cerrar
    Enviar por Correo