Skip to content

Commit

Permalink
add custom 404 page
Browse files Browse the repository at this point in the history
  • Loading branch information
benderl committed Nov 30, 2023
1 parent 18aec51 commit d6848eb
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<IfModule mod_headers.c>
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
</IfModule>

RedirectMatch 404 \.conf$
RedirectMatch 404 \.ini$
RedirectMatch 404 \.py$
ErrorDocument 404 /openWB/web/error.html
39 changes: 39 additions & 0 deletions web/error.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* prevent scroll gestures */
body,
html {
overscroll-behavior: none;
}

body,
html {
border: 0;
margin: 0;
padding: 0;
background-color: black;
color: white;
font-family: Open Sans;
}

a {
color: inherit;
text-decoration: underline;
font-weight: bold;
}

.wrapper {
display: flex;
justify-content: center;
}

#notReady {
display: flex;
flex-direction: column;
padding-top: 10vh;
}

#logo {
display: flex;
flex-direction: column;
align-content: center;
flex-wrap: wrap;
}
44 changes: 44 additions & 0 deletions web/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="de">

<head>
<base href="/openWB/web/">
<meta charset="UTF-8">
<link rel="shortcut icon" href="img/favicons/favicon.ico">
<link rel="stylesheet" type="text/css" href="error.css?ver=20230322">
<title>404 - document not found</title>
</head>

<body>
<div class="wrapper">
<div id="notReady">
<div id="logo">
<img src="img/openWB_logo_dark.png" alt="logo image">
</div>
<div>
<h1>Fehler 404: Die aufgerufene Seite wurde nicht gefunden.</h1>
<p>Bitte aktualisieren Sie ggf. Ihre Lesezeichen.</p>
<p>
Die Startseite erreichen Sie unter
<a id="start-url" href="/">http://[meine-openWB]/</a>.
</p>
<p>
Direkter Zugriff auf die Einstellungen:
<a id="settings-url" href="/openWB/web/settings/">http://[meine-openWB]/openWB/web/settings/</a>
</p>
</div>
</div>
</div>
<script>
function replaceHostname(elementId) {
const placeholder = "[meine-openWB]";
let url = document.getElementById(elementId).innerHTML;
return url.replace(placeholder, location.hostname);
}
document.getElementById("start-url").innerHTML = replaceHostname("start-url");
document.getElementById("settings-url").innerHTML = replaceHostname("settings-url");
</script>

</body>

</html>

0 comments on commit d6848eb

Please sign in to comment.