Apache – How to nest a Location directive inside a virtual host config

apache

I am trying nest a Location directive inside a virtual host config like this:

<VirtualHost *:80>  
    ServerName mysite.com  
    DocumentRoot /home/deployer/apps/mysite/current/public  
    ErrorLog /var/log/prod.log  
    <Location "/shop">
        DocumentRoot /home/deployer/apps/mysite_shop/current/public  
        ErrorLog /var/log/prod.log  
    </Location>  
</VirtualHost>

What I want to do is go to mysite.com/shop, and point it to another application. Is this possible? Is there another method of doing this? I get an error because apparently Location directives do not accept DocumentRoot.

Thanks.

Best Answer

Do you want this to work as a redirect? If so, have a look at mod_rewrite. If not, have a look at the Alias directive.

Related Topic