logo
Host multiple websites on an Apache server
Using Alias
Multiple websites on the same server

Host multiple websites on an Apache server

To use this method it is necessary to enable the module "mod_alias".

Using Alias:

With aliases, it is possible to link an address like http://serveur/truc and a folder on the server.
 Alias /website /path/to/root/of/website
Whhen a client connects to http://serveur/website he is redirected to /path/to/root/of/website. We must also allow the folder to be read by adding:
 
 <Directory /path/to/root/of/website>
 Order allow,deny
 Allow from all
 </Directory>
 
The problem that may be encountered in a production environment is that aliases are case sensitive. To avoid this, it is possible to use:
 
 AliasMatch (?i)^/website(.*) /path/to/root/of/website$1
 
By using this alias paired with the regular expression, the alias is case insensitive.

Multiple websites on the same server:

Using aliases it is possible to host several websites on the same server. It only requires to create an alias for each hosted website.
Be The First To Comment.

Add a comment:





You can use these HTML tags: <br><a><i><b>