I have had a seemingly constant battle with webdav for some reason over the years. We use it to hold Kate's graduate work and temporary work storage so it is constantly needed. TO its credit the problems ive had have never been its own making but rather a conflation of issues from installing so many services on top of eachother (Subversion, Drupal, Webdav). My most recent battle involved not being able to write to the webdav folder that existed as a subdirectory of a drupal site. THe READ, DELETE and other actions worked fine but the PUT action failed because drupals mod_rewrite routine jumped in and stole the show. The result was a 403 error in my webdav client and for all you google searchers out there the error log parroted out something like this:
[Fri Mar 06 10:19:56 2009] [error] [client XXX.XXX.XXX.XXX] Unable to PUT new contents for /dav/filename.txt. [403, #0]
[Fri Mar 06 10:19:56 2009] [error] [client XXX.XXX.XXX.XXX] (2)No such file or directory: An error occurred while opening a resource. [500, #0]
The solution was simple if not intuitive. Disable the mod_rewrite for this directory and all will be fixed. This can be done by adding an exclusion to the drupal .htaccess file in the mod_rewrite section or by disabling it completely in a .htaccess file that resides right in webdav. Both solutions are shown below but only one needs to be used:
I have drupal installed to the root directory (httpdocs) of my virtual host such that www.example.com pulls up drupal. I have created a folder in this directory called "webdav" and mapped an alias from "webdav" to "dav". Like so:
Alias /dav /var/www/vhosts/example.com/httpdocs/webdav
<Location /dav/>
DAV on
</Location>
This was necessary for some old MS windows webdav clients if I remember correctly but the mod_rewrite part only cares about the functioning webdav directory I have defined. If you have an otherwise functioning webdav directory without using the <Location> tags in your vhost file then don't worry about it and just use that directories name.
File: .htaccess of parent directory which is also the root directory in this case
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} !^/dav/(.*)$
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
I only added the 4th one to the existing ones in the drupal .htaccess file but, these 4 lines of rewrite conditions basically say:
If the requested URI isnt a real file (line 1), and if it isnt a real directory (line 2) and if it isnt "/favicon.ico" (line 3) and finally (line 3) if it doesnt (!) start with "/dav/" (^/dav/) followed by any number of other characters ( (.*) ) until the end ($). Here is a useful cheatsheet for mod_rewrite that i like to use if your matching conditions vary from mine.
File: .htaccess in the webdav directory itself
#Disable mod_rewrite
RewriteEngine off
This one need much less explanation I think but it is also slightly less insecure and messy in my opinion. Either way you go you'll have better luck than you did before I promise. Good luck and comment if you have a question or this was useful to you.
Comments
YOU ARE MY HERO! We use
YOU ARE MY HERO! We use webdav as a comment repository for Acrobat review...and of course its located on a sub-directory of our intranet....which is Drupal. When it all stopped dead today, I was pretty sure it was my .htaccess file, but I couldn't figure out what the heck needed changing. You saved me days of chasing my tail! Many thanks.
Always happy to help Bethany.
Always happy to help Bethany. Thanks for dropping a line and letting me know I'm not writing into the ether :). Good luck. -mf
I was beating my head against
I was beating my head against the proverbial wall. Thank you very much!
Huge thanks! I too was
Huge thanks! I too was beating my head against the wall (and anything else I could find) trying to overcome this problem. Your post saved me (and my head). Three cheers for Michael!
Thanks for the fix. Great
Thanks for the fix. Great post :)
I fell very great to read
I fell very great to read your blogs.
Very good post, thanks a lot.
Very good post, thanks a lot.
Yes, adding this line to
Yes, adding this line to .htaccess worked for me:
RewriteCond %{REQUEST_URI} !^/dav/(.*)$
Many thanks
In 1800, the Romantic era
In 1800, the Romantic era (1800-1890s) in web hosting review music developed, with Ludwig van Beethoven and Franz Schubert as transitional composers who introduced a more dramatic, expressive style. During this era, existing genres, forms, and functions of music were developed, and the email hosting emotional and expressive qualities of music came to take precedence over technique and tradition. In Beethoven's case, motifs (developed organically) came to replace melody as the most significant compositional unit. The late 19th century saw a dramatic free web hosting expansion in the size of the orchestra, and in the role of concerts as part of urban society. Later Romantic composers such as Pyotr Ilyich Tchaikovsky and Gustav Mahler created complex and often much longer musical works. They used more complex chords and used website design more dissonance to create dramatic tension.
Post new comment