Cody A. Ray

Wordpress, WebDAV, and Dreamhost

August 8, 2010 · updated September 15, 2010

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<br />
ErrorDocument 403 /misc/myerror.html</p>

<p># BEGIN WordPress<br />
<IfModule mod_rewrite.c><br />
RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule . /index.php [L]<br />
</IfModule></p>

<p># 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<br />
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<br />
ErrorDocument 403 /misc/myerror.html

Voila! We have Wordpress and WebDAV working together on Dreamhost!

10 comments

Imported from the previous site.

Jay· September 27, 2010
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· September 27, 2010
I'm happy this could be of use to others as well. =D
JW· February 4, 2011
This worked for me on dreamhost with Wordpress and some normal password-protected sub folders in my domain. Thanks for the easy solution!
codyaray· February 4, 2011
Excellent! I'm glad to hear that it works for normal password-protected folders, too!
Keith· November 7, 2012
Well, this just keeps on giving! Like JW above, this worked flawlessly for me for a couple password-protected sub folders. Kudos!
Diane· December 13, 2012
Thank you! So frustrating! This fix worked for HostGator, regular password protected folders as well.
Andrew· April 12, 2013
Worked for me on Dreamhost using Drupal, which also has pretty URL's, and has similar .htaccess settings for mod_rewrite. THANKS!!
codyaray· April 12, 2013
Awesome! Really cool that it works for other use cases too. Glad to help!
David· April 18, 2013
Wow, you really helped me out! Thanks a bunch!
codyaray· April 18, 2013
Glad to help! And love your email address ;-)
© 2009–2026 Cody A. Ray
RSSGitHubLinkedIn