Reputation: 4479
I want different domains to route to sub-directories on the same server.
Example:
If my Apache root is /var/www/ - I want example1.com to route to /var/www/example1/ - and example2.com to route to var/www/example2/.
Do I need to configure Apache ? Or should I write a PHP script in /var/www/index.php that routes ?
Upvotes: 1
Views: 347
Reputation: 1204
Do you have access to your Apache configuration file, possibly in /etc/apache2/apache2.conf
or /etc/httpd/httpd.conf
?
<VirtualHost *:80>
DocumentRoot "/var/www/example1"
ServerName example1.com
ServerAlias www.example1.com
<Directory "/var/www/example1">
allow from all
Options -Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/example2"
ServerName example2.com
ServerAlias www.example2.com
<Directory "/var/www/example2">
allow from all
Options -Indexes
</Directory>
</VirtualHost>
More information at http://httpd.apache.org/docs/2.2/vhosts/
Upvotes: 1