Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
ServerAlias *
DocumentRoot "/var/www/"
DirectoryIndex index.php
Alias /sf /var/www/

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


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

<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteLog "/var/www/"
    RewriteLogLevel 3

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

share|improve this question

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

share|improve this answer
Not the case unfortunately, throws "Module rewrite already enabled" – Ain Sep 17 '12 at 12:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.