Howto Redirect a Hostname to a Different URL


How to redirect from a hostname to a different URL.

Step 1

To redirect a request for “http://external.multi.ucs” to the new URL “https://internal.multi.ucs/univention/self-service/#passwordchange
Create a file named i.e. “hostredirect” in the directory /etc/apache2/sites-available/ with the content:

<VirtualHost *>
  ServerName external.multi.ucs
  Redirect 301 / https://internal.multi.ucs/univention/self-service/#passwordchange

Step 2

Enable your configuration.
root@mult:~# a2enconf hostredirect

Step 3

Reload Apache
root@multi.ucs:~# systemctl reload apache2

1 Like