Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Currently, I have a VirtualHost defined like so:

<VirtualHost *:80>
    DocumentRoot /var/www/project/

How can I make an Alias that only affects the domain:

Alias /sub /var/www/other

So that: -> /var/www/other -> /var/www/project/sub

The VirtualHost in question is not that simple in reality, so I'd rather not make separate VirtualHosts just for this. Are there any conditional expressions or similar that I can use inside the VirtualHost? Something along the lines of:

<VirtualHost *:80>
        Alias /sub /var/www/other
share|improve this question
Can you clarify what your configuration needs are? From what you've provided, it seems like a poster child for separate vhosts.. but what you're looking for can probably be done with mod_rewrite and a single vhost if needed. – Shane Madden Aug 14 '12 at 6:07

Here are the relevant bits of the Apache documentation:


In that case, something like this should work:

<If "%{HTTP_HOST} == ''">
    Alias /sub /var/www/other

I believe you will need Apache 2.2 or greater for the "If" functionality.

share|improve this answer
You're going to need at least Apache 2.4 to use that directive. – erickzetta Aug 13 '12 at 19:02
This gives me a Alias not allowed here – reinder Feb 10 at 6:08

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.