1

The hostname where I want to redirect to looks like:

<VirtualHost *:80>
       ServerName my.dav.hostname.com
       ErrorLog /var/log/open-xchange/dav-err.log
       TransferLog /var/log/open-xchange/dav-access.log
       <Proxy />
               Order allow,deny
               Allow from all
       </Proxy>
       ProxyPass / ajp://localhost:8009/servlet/dav/ smax=0 ttl=60 retry=5
</VirtualHost>

I want to do something like if someone goes to a URL my.hostname.com/dav, I want it to be rewritten to my.dav.hostname.com.. If the client goes to a URL other than /dav, he should not be redirected.

<VirtualHost *:80>
       ServerName my.hostname.com
       ErrorLog /var/log/open-xchange/dav-err.log
       TransferLog /var/log/open-xchange/dav-access.log
       .. 
       ..
</VirtualHost>

I'm clueless on how I should proceed.

Something like this doesn't work:

RewriteEngine on
RewriteRule /servlet/webdav.infostore http://my.dav.hostname.com [L,NE,QSA]

As it actually redirects to my.dav.hostname.com which I don't want. What I want is for apache to transparently do it for me.

2 Answers 2

0

This should work:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^my.dav.domain.com [NC]
RewriteRule ^/dav/(.*)$ http://my.dav.domain.com/$1 [R=301,NC]

Personally I wouldn't use your subdomain structure though. It's better to use dav.subdomain.domain.com over subdomain.dav.domain.com.

1
  • I don't want a a redirect, I want apache to do it transparently. Sorry, I wasn't clear enough earlier. Jun 4, 2013 at 10:37
0

If you want apache to do this transparantly (ie. the URL in the browser must not change) you could just simply mount your DAV servlet in the other server too:

ProxyPass /dav/ ajp://localhost:8009/servlet/dav/ smax=0 ttl=60 retry=5
1
  • That's not gonna work because then all requests starting going to dav servlet. I also tried it to add it under <Location /dav, but it seems, it's not possible Jun 5, 2013 at 13:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .