HowTo
Configure a permanent redirect from a defined path to another URL.
Step by step instruction
- Login as root user to the UCS system via SSH
- Change the template file
/etc/univention/templates/files/etc/apache2/ucs-sites.conf.d/ucs-sites.conf
These two lines should be added and the content is similiar like this:
The path and the URL must be changed to the fitting values in your scenario.
##Change for redirecting the path "/path" to "https://redirected.url.net"
Redirect 301 /path https://redirected.url.net
Template file looks then like:
@%@UCRWARNING=# @%@
RewriteEngine on
RewriteOptions Inherit
ProxyPreserveHost on
ProxyTimeout 600
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS}
DocumentRoot @%@apache2/documentroot@%@
CustomLog /var/log/apache2/access.log combined
##Change for redirecting the path "/path" to "https://redirected.url.net"
Redirect 301 /path https://redirected.url.net
@!@
print('RedirectMatch ^/$ /%s' % configRegistry.get('apache2/startsite', 'univention/'))
@!@
The path and the URL must be changed to the fitting values in your scenario.
- Commit the changes to the active used configuration from Apache with
ucr commit /etc/apache2/ucs-sites.conf.d/ucs-sites.conf
- Reload the Apache configuration with
systemctl reload apache2.service
- Test the changes