Apache trying to load from DocumentRoot instead of Alias directory

Jago picture Jago · Jul 15, 2013 · Viewed 7.5k times · Source

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/* ?

Answer

Qiau picture Qiau · Jul 15, 2013

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>
[...]