HTTP / HTTPS Redirect

Für einen Redirect gibt es sicherlich viele Beispiele, hier zeige ich zwei Varianten.

Kopieren Sie die Daten in eine Textdatei und Speichern diese als index.html, default.html. Beachten Sie hierbei Ihre Systemeinstellung welche html-Datei automatisch geladen wird.

Einfacher Redirect:

<html>
	<head>
		<meta http-equiv="refresh" content="0;URL='/Unterseite" />
	</head>
	<body></body>
</html>

Umleitung von HTTP auf HTTPS:

<html>
	<head>
		<script type="text/javascript">
		function redirectToHttps(){
			var httpURL = window.location.hostname + window.location.pathname;
			var httpsURL = "https://" + httpURL ;
			window.location = httpsURL ;
		}
		redirectToHttps();
		</script>
	</head>
	<body></body>
</html>

Eine Antwort schreiben