Dear lazyweb, I’m having severe issues with Apache’s mod_rewrite on my VPS. I’m pretty sure what I want to do is doable, but I can’t figure out the rewrite rules to allow it.

In my httpd.conf I have something similar to this:

<IfModule mod_dav.c>
    LimitXMLRequestBody 131072
    DavLockDB /var/dav/DavLock

    Alias /dav "/home/user/dav"
    #<Directory /home/user/dav>
    <Location /dav>
        Dav On
        Options +Indexes
        IndexOptions FancyIndexing
        AddDefaultCharset UTF-8
        AuthType Basic
        AuthName "Private"
        AuthUserFile /home/user/dav.passwd
        Require valid-user
    </Location>
    #</Directory>
</IfModule>

This worked fine when the root of the site had nothing but a simple index.html in it. Now I’ve got Drupal7 installed, so it does all the fancy mod_rewrite stuff to get the clean urls, etc. And now when I go to https://site/dav, Drupal is answering and saying “no such directory”. If I have /home/user/dav for the private WebDAV share, I’m using /home/user/public_html/ for the accessible web site (I do this to prevent any accidental exposure to those data files). Incidentally I tried with both <Location> and <Directory> and it makes no difference.

The .htaccess in /home/user/public_html/ looks like this (just the important bits):

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteRule ^/dav(/.*)$ /dav/$1 [L,QSA]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

</IfModule>

I’ve tried a number of variations (the above is my latest try). Also tried things like:

  RewriteCond %{REQUEST_URI} !^/dav

With and without the extra .* bits, etc.

I am literally tearing my hear out here. Does anyone have any idea what I’m doing wrong? I basically want it to go “hey, you want /dav? ok, I won’t rewrite anything and you can have it) and have /dav/[whatever] loaded requiring auth to access. Something in the mod_rewrite is killing it, and I suspect it might have to do with Alias. Maybe all this stuff needs to be in httpd.conf instead of .htaccess?

Share on: TwitterLinkedIn


Related Posts


Published

Category

Linux

Tags

Stay in touch