Simple Redirect with Apache2

It’s obvious Apache2 is no more the first choice for a webserver, depending on the requirments Ngnix and IIS are now much more attractive.

Maybe you’ve already updated to Ngnix or IIS want to redirect from the old website to the new website in case Apache is still a dependency.

The most simple solution to redirect a website domain or url to a new website is this apache virtual host configuration:


<VirtualHost *:80>
  ServerName domain.ch
  ServerAlias www.domain.ch
  ServerAdmin webmaster@domain.ch
  ErrorLog /var/log/apache2/domain.ch-error.log
  CustomLog /var/log/apache2/domain.ch-access.log combined
  Redirect permanent / https://www.somewhere.ch/aktuell/whatever/
</VirtualHost>

Latest version of this snippet: https://gist.github.com/7481550

Leave a Reply