Wednesday, April 08, 2009

Wordpress htaccess clashes with sub-directory

The situation:

Wordpress installed in root / with its default .htaccess file
I had another script installed in /otherscript sub-directory with .htaccess/.htpasswd protection.

The problem:

Trying to access the /otherscript sub-directory creates a Wordpress 404 error, rather than the pop-up login box you'd expect to see.

The solution:

Simply edit the Wordpress .htaccess and at the very top of the file add:
ErrorDocument 401 default
All thanks for this solution go to Andrew Rollins who blogged about this back in 2008 - I have merely made my own record of it here just in case anything ever happened to Andrew's page. Also if you check his blog posting you'll find some alternatives to the line above, such as specifying a custom 401 page.

1 comments:

Denis said...

FOR THE LOVE OF GOD, THANK YOU FOR POSTING THIS COMMENT!

It's been driving me nuts and I haven't been able to find a solution to the 404 error Wordpress was giving me, until just now!

Thanks,
Denis