I couldn’t find a good comprehensive solution for this posted anywhere on the net, so I thought I’d share what I learned.
Since setting up this WordPress-based blog, the WebDAV file store for my zotero (a research tool) has been dead. When trying to reach the WebDAV directory, WordPress “intercepted” my request and showed me a WordPress 404 error instead. For the impatient, the workaround is to add two ErrorDocument tags to the WordPress .htaccess file.
My final .htaccess file looks like
ErrorDocument 401 /misc/myerror.html ErrorDocument 403 /misc/myerror.html # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress |
Of course, you must also create the error document /misc/myerror.html.
For the curious (and for the googlebots searching for this solution), the problem was that WordPress and WebDAV wouldn’t work together on Dreamhost. WordPress pretty URLs use mod_rewrite, which intercepts visitors to the WebDAV-enabled directory. The mod_rewrite block includes the conditions
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d |
that appear to instruct mod_rewrite not to touch existing files or directories. However, they’re not doing their job for some reason. Likely, the issue is caused by the .htaccess file that Dreamhost uses in the WebDAV-enabled directory to enable password-protection. This file (and the entire WebDAV directory) is owned by dhapache, so there’s not much we can do about this file as users. Regardless, it turns out that Dreamhost doesn’t have proper handler set for 401 and 403 errors. Thus, adding the following two lines to the root .htaccess file does the trick:
ErrorDocument 401 /misc/myerror.html ErrorDocument 403 /misc/myerror.html |
Voila! We have WordPress and WebDAV working together on Dreamhost!
Thanks for posting these instructions. I just spent the past hour battling the exact same problem, and finally found the StackOverflow page and this post. It’s working now!
I’m happy this could be of use to others as well. =D
This worked for me on dreamhost with WordPress and some normal password-protected sub folders in my domain. Thanks for the easy solution!
Excellent! I’m glad to hear that it works for normal password-protected folders, too!
Well, this just keeps on giving! Like JW above, this worked flawlessly for me for a couple password-protected sub folders. Kudos!
Thank you! So frustrating! This fix worked for HostGator, regular password protected folders as well.
Worked for me on Dreamhost using Drupal, which also has pretty URL’s, and has similar .htaccess settings for mod_rewrite. THANKS!!
Awesome! Really cool that it works for other use cases too. Glad to help!
Wow, you really helped me out! Thanks a bunch!
Glad to help! And love your email address 😉