0

Could anyone help to with the following issue:

I'm trying to do a rewrite on all domains that won't match and push them to a given folder. The following vhost works locally (Mac OS X with XAMPP), but is not working on a Debian server:

<VirtualHost *:80>
UseCanonicalName On
ServerName www.domain.de
ServerAlias *
DocumentRoot "/var/www/www.domain.de/current/web"
DirectoryIndex index.php
Alias /sf /var/www/www.domain.de/current/lib/vendor/symfony/data/web/sf

ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined

SetEnv SYMFONY_ENVIROMENT prod

<Directory />
    Options +Includes 
    Options +FollowSymlinks 
    Options -Indexes
    AllowOverride All
    AuthType Basic
    AuthName "Info"
    AuthUserFile /var/www/www.domain.de/current/.htpasswd
    Require valid-user
</Directory>

<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteLog "/var/www/www.domain.de/current/log/rewrite.log"
    RewriteLogLevel 3

    # Rewrites to host folder if not a main/my domain
    RewriteCond %{HTTP_HOST} !^(www\.)?domain.de|(www\.)?my-domain.(de|net|at|ch|eu|com)$
    RewriteRule ^(.*)$ /var/www/www.domain.de/current/websites/aliases/%{HTTP_HOST}/$1 [L]
</IfModule>

Ain
  • 188
  • 7

1 Answers1

0

on debian mod_rewrite is disabled by default. So try to enable it then restart apache

Enabling mod_rewrite

 a2enmod rewrite

Then restart apache

 /etc/init.d/apache2 restart

Then try the rules

Mike
  • 21,910
  • 7
  • 55
  • 79