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.