Archive | Sysadmin RSS for this section

Apache2: redirect different domains to subfolder

In the aim to merge two of my server on digitalocean, today I tried to write a mod_rewrite rule to redirect a secondary domain to a subfolder. After one hour, I found that I can do that with a VirtualHosts!

Just edit the file /etc/apache2/sites-available/default and add a rule for each domain at the end of file:

<VirtualHost *:80>
ServerName http://www.domain.org
DocumentRoot /var/www/vhosts/domain.org/www
</VirtualHost>

It’s easy, if you know.

Advertisements