HowTo: Redirect to maintenance site

How To: Redirect visitors to a maintenance site

Step 1

Create a maintenance site inside of the Apache documentroot, normally /var/www/. (ucr get apache2/documentroot)

For example:

/var/www/maintenance.html
<!DOCTYPE html>
<title>Maintenance</title>
<style>
	body { text-align: center; padding: 150px; }
	h1 { font-size: 50px; color: #DD042D; }
	body { font: 20px Helvetica, sans-serif; color: #333; }
	article { display: block; text-align: left; width: 650px; margin: 0 auto; }
</style>

<article>
		<div>
				<h1>Wartungsarbeiten / Maintenance</h1>
				<p>Liebe Besucher,<br><br>
				derzeit befindet sich das System in Wartung.<br><br>
				Mit freundlichen Gr&uuml;&szlig;en<br>
				der Administrator</p>
				<hr>
				<p>Dear visitors,<br><br>
				for now this system will remain in maintenance.<br><br>
				Regards<br>
				your admin</p>
		</div>
</article>

which would result in
2021-02-09-125452

Step 2

Assign the new site to the UCR startsite variable:
Do not forget to save the old value! (Per default this will be univention/)

ucr set apache2/startsite=maintenance.html

Step 3

Restart the Apache service to apply the redirect:

/etc/init.d/apache2 restart

(Step 4)

After the maintenance is done, revert the adjustments:

ucr set apache2/startsite=<STARTSITE> && /etc/init.d/apache2 restart
2 Likes
Mastodon