Skip to content


WordPress, WebDAV, and Dreamhost

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!

Posted in Tutorials.


10 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Jay says

    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!

    • codyaray says

      I’m happy this could be of use to others as well. =D

  2. JW says

    This worked for me on dreamhost with WordPress and some normal password-protected sub folders in my domain. Thanks for the easy solution!

    • codyaray says

      Excellent! I’m glad to hear that it works for normal password-protected folders, too!

  3. Keith says

    Well, this just keeps on giving! Like JW above, this worked flawlessly for me for a couple password-protected sub folders. Kudos!

  4. Diane says

    Thank you! So frustrating! This fix worked for HostGator, regular password protected folders as well.

  5. Andrew says

    Worked for me on Dreamhost using Drupal, which also has pretty URL’s, and has similar .htaccess settings for mod_rewrite. THANKS!!

    • codyaray says

      Awesome! Really cool that it works for other use cases too. Glad to help!

  6. David says

    Wow, you really helped me out! Thanks a bunch!

    • codyaray says

      Glad to help! And love your email address ;-)



Some HTML is OK

or, reply to this post via trackback.



Log in here!