Search code examples
apachedirectorydocument-root

Apache trying to load from DocumentRoot instead of Alias directory


I have set up my DocumentRoot to be, let's say, X.

Also, I have an Alias /web pointing to directory Y.

I can load the homepage at /web without any issue. But for any other page in the same website as the homepage of /web, Apache tries to load it from X instead of Y.

How can I make Apache to load all the contents of /web/* from Y/* instead of X/* ?


Solution

  • Maybe you are missing out the Directory directive for the aliased directory?

    This configuration works fine for me:

    [...]
    DocumentRoot /web
    [...]
    <Directory /web/>
           Options Indexes FollowSymLinks MultiViews
           AllowOverride None
           Order allow,deny
           allow from all
    </Directory>
    
    Alias /web2/ "/var/www/"
    <Directory "/var/www">
           Options FollowSymLinks
           AllowOverride None
    </Directory>
    [...]