Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure Apache .conf for Alias [closed]

So I cant get an alias working in "/etc/httpd/conf.d/vhosts.conf" which contains all of my virtual hosts:

<VirtualHost *> 
    ServerName example.com
    Alias /ncn /var/www/html/ncn
    DocumentRoot /var/www/html/mjp
</VirtualHost>

I want my alias to work so I can point example.com/ncn to "/var/www/html/ncn".

This works if I have it in "/etc/httpd/conf/httpd.conf" but not my "/etc/httpd/conf.d/vhosts.conf"

Any ideas why? Everything else seems to work i.e. ServerAlias's

Cheers, Peter

like image 670
ptimson Avatar asked Apr 02 '13 17:04

ptimson


People also ask

What is alias in httpd conf?

The Alias and ScriptAlias directives are used to map between URLs and filesystem paths. This allows for content which is not directly under the DocumentRoot served as part of the web document tree. The ScriptAlias directive has the additional effect of marking the target directory as containing only CGI scripts.

Do I need to restart Apache after changing httpd conf?

Yes. HTTPD. conf is read on apache start-up, so for any changes to take affect you need to restart it.


1 Answers

Sorry not sure what was going on this worked in the end:

<VirtualHost *> 
    ServerName example.com
    DocumentRoot /var/www/html/mjp

    Alias /ncn "/var/www/html/ncn"

    <Directory "/var/www/html/ncn">
        Options None
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
like image 59
ptimson Avatar answered Oct 22 '22 13:10

ptimson