Forums / Install & configuration / Setting up WebDAV... the weird way
Sebastian Picklum
Thursday 26 January 2006 9:11:39 am
Hi!
I tried to set up WebDAV on my new hosting plan. Unfortunately, every subdomain points to a directory under my ez-publish root (~/public_html). So webdav.mydomain -> ~/public_html/webdav. The only possibility to configure the RewriteRules is via .htaccess.So I placed a .htaccess with
RewriteEngine on RewriteRule !^index\.php.* - [C] RewriteRule .* /index.php?/$1
in the webdav dir and wrote an index.php containing
chdir (".."); include("webdav.php");
That way I can now access the root-dir of my server via webdav. But changing into an siteaccess gives me an error:
dav:/> ls Listing collection `/': succeeded. Coll: plain_user 0 Jan 26 10:08 dav:/> cd plain_user Could not access /plain_user/ (not WebDAV-enabled?): Did not find a collection resource.
sp@php.net
Michael Zeidler
Thursday 26 January 2006 3:47:05 pm
I would say placing the question mark before the slash ( RewriteRule .* /index.php?/$1 ) could make problems, because usually GET-Parameters are placed after it.Also it would be interessting what pieces of information are shown in the log file placed in ./var/log/webdav.log. Please look what values were assigned to $site and $path as mentioned here http://ez.no/community/forum/install_configuration/setting_up_webdav_on_3_7_4_stable_svn . Maybe there is a relationship between our problems.
------------------------------------------------------------------------------------------- join #ezpublish on irc.freenode.org
Friday 27 January 2006 2:47:24 am
The RewriteRule is completely right as the installation operates in CGI-mode where pages are accessed like this: www.somedomain.net/index.php?/content/view/full/2
The fact that I wasn't aware that the installation was running in CGI-Mode was my whole problem. So I think our problems aren't that related :-)
I did a few tweaks and now it runs smoothly. I can even authenticate via http-auth in webdav using the following solution:Added the following to the WebDAV-RewriteRule:
RewriteRule (.*) /webdav.php/$1?CGI_AUTH_DATA=%{HTTP:Authorization}
Added the following at the top of webdav.php
if((empty($_SERVER['PHP_AUTH_USER']) or empty($_SERVER['PHP_AUTH_PW'])) and isset($_REQUEST['CGI_AUTH_DATA']) and preg_match('/Basic\s+(.*)$/i', $_REQUEST['CGI_AUTH_DATA'], $matc)) list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode($matc[1]));
Voilá, WebDAV in CGI-Mode works!
Friday 27 January 2006 6:41:56 am
So basically it was an authentication issue. Unfortunately the webdav-code hasn`t caught the missed information in $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']. Also its right that my problem wasn`t related to yours as my authentication data weren´t lost.Anyway, congrats ;)