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

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

1 Answer 1

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

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.