Forum Moderators: phranque

Message Too Old, No Replies

Redirect for second Document Root does not work

Redirect second Document Root virtual host

         

kodiakz

10:36 am on Oct 20, 2011 (gmt 0)

10+ Year Member



Hello,
thats my first post here. I tried to figure out all my self until now, but now I need some advice.

I have set up apache on an ubuntu machine. It runs a web-server for web-email realated stuff, and afterwards I got davical for caldav running on the same.

For the webmail-stuff I got a redirect running from http to https. But it does not work for davical. Access to [domain.de...] does not redirect.

Here is my default config for in sites-available:


<VirtualHost *:80>
RewriteEngine on
RedirectMatch ^/mail$ https://domain.de/mail/
RedirectMatch ^/webmail$ https://domainde/mail/
RedirectMatch ^domain\.de/mail https://domainde/mail/
# does not work
RedirectMatch ^/davical$ https://domainde/davical/
# does not work
RedirectMatch ^domain\.de/davical https://domainde/davical/

ReWriteCond %{HTTP_HOST} ^www.domain\.de
RewriteRule ^/(.*)$ http://domain.de/$1 [NC,R,L]
DocumentRoot /var/www/web

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /var/www/davical
DirectoryIndex index.php index.html
ServerName davical.domain.de

# does not work
RedirectMatch ^/davical$ https://domain.de/mail/
# does not work
RedirectMatch ^domain\.de/davical https://domain.de/mail/
Alias /images/ /usr/share/davical/htdocs/images/

<Directory /usr/share/davical/htdocs/>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
AcceptPathInfo On
php_value include_path /usr/share/awl/inc
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value error_reporting "E_ALL & ~E_NOTICE"
php_value default_charset "utf-8"

ErrorLog /var/log/apache2/error.log
</VirtualHost>


Any hints to go on?

Cheers,
Marc

lucy24

10:26 pm on Oct 20, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



<begin g1 impersonation>

For starters, you need to get a solid grip on the difference between mod_alias [httpd.apache.org] (Redirect or RedirectMatch by those names) and mod_rewrite [httpd.apache.org] (RewriteRule, optionally ending in [R=301] flag).

After you have done this, you change all rules using mod_alias into rules using mod_rewrite.

</end impersonation>

Last time I did this, the OP flew into a rage and declared that if he needed links he could find them for himself. This may or may not be true, but is not likely to foster the spirit of helpfulness.