apache2ubuntu-12.04

Apache2 Alias not working in Ubuntu?


I've just setup apache/php/mysql in Ubuntu 12.04, and I've created an Alias for my virtual directory, here's my /etc/apache2/sites-enabled/000-default file:

Alias /demo/ "/home/czetsuya/projects/eclipse/eclipse-php/demo-portfolio"
<Directory "/home/czetsuya/projects/eclipse/eclipse-php/demo-portfolio">
    DirectoryIndex index.php
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
    Allow from all
</Directory>

Note that I've already applied chown and chmod to: /home/czetsuya/projects/eclipse/eclipse-php/demo-portfolio

chown www-data:www-data /home/czetsuya/projects/eclipse/eclipse-php/demo-portfolio -R
chmow 777 /home/czetsuya/projects/eclipse/eclipse-php/demo-portfolio -R

But when I access: _http://localhost/demo, I got a 404 Not found error. Looking at /var/log/apache2/error.log I found that it's still pointing at /var/www/demo:

File does not exist: /var/www/demo

Any idea why Alias is ignored?

Note that I already restart and reload apache2. And rewrite is also enabled.

Thanks,
czetsuya


Solution

  • Your problem can most likely be solved by the mod_alias manual;

    Note that if you include a trailing / on the URL-path then the server will require a trailing / in order to expand the alias. That is, if you use

    Alias /icons/ /usr/local/apache/icons/ then the URL /icons will not be aliased, as it lacks that trailing /.

    Try changing /demo/ to /demo in your alias, and it should work better.