Skip to content

Commit d7aae86

Browse files
committed
add custom 404 page
1 parent 18aec51 commit d7aae86

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

.htaccess

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<IfModule mod_headers.c>
2+
Header set Cache-Control "no-cache, no-store, must-revalidate"
3+
Header set Pragma "no-cache"
4+
Header set Expires 0
5+
</IfModule>
6+
17
RedirectMatch 404 \.conf$
28
RedirectMatch 404 \.ini$
39
RedirectMatch 404 \.py$
10+
ErrorDocument 404 /openWB/web/error.html

web/error.css

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* prevent scroll gestures */
2+
body,
3+
html {
4+
overscroll-behavior: none;
5+
}
6+
7+
body,
8+
html {
9+
border: 0;
10+
margin: 0;
11+
padding: 0;
12+
background-color: black;
13+
color: white;
14+
font-family: Open Sans;
15+
}
16+
17+
a {
18+
color: inherit;
19+
text-decoration: underline;
20+
font-weight: bold;
21+
}
22+
23+
.wrapper {
24+
display: flex;
25+
justify-content: center;
26+
}
27+
28+
#notReady {
29+
display: flex;
30+
flex-direction: column;
31+
padding-top: 10vh;
32+
}
33+
34+
#logo {
35+
display: flex;
36+
flex-direction: column;
37+
align-content: center;
38+
flex-wrap: wrap;
39+
}

web/error.html

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="de">
3+
4+
<head>
5+
<base href="/openWB/web/">
6+
<meta charset="UTF-8">
7+
<link rel="shortcut icon" href="img/favicons/favicon.ico">
8+
<link rel="stylesheet" type="text/css" href="error.css?ver=20230322">
9+
<title>404 - document not found</title>
10+
</head>
11+
12+
<body>
13+
<div class="wrapper">
14+
<div id="notReady">
15+
<div id="logo">
16+
<img src="img/openWB_logo_dark.png" alt="logo image">
17+
</div>
18+
<div>
19+
<h1>Fehler 404: Die aufgerufene Seite wurde nicht gefunden.</h1>
20+
<p>Bitte aktualisiere ggf. Deine Lesezeichen.</p>
21+
<p>
22+
Die Startseite erreichst Du unter
23+
<a id="start-url" href="/">http://[meine-openWB]/</a>.
24+
</p>
25+
<p>
26+
Direkter Zugriff auf die Einstellungen:
27+
<a id="settings-url" href="/openWB/web/settings/">http://[meine-openWB]/openWB/web/settings/</a>
28+
</p>
29+
</div>
30+
</div>
31+
</div>
32+
<script>
33+
function replaceHostname(elementId) {
34+
const placeholder = "[meine-openWB]";
35+
let url = document.getElementById(elementId).innerHTML;
36+
return url.replace(placeholder, location.hostname);
37+
}
38+
document.getElementById("start-url").innerHTML = replaceHostname("start-url");
39+
document.getElementById("settings-url").innerHTML = replaceHostname("settings-url");
40+
</script>
41+
42+
</body>
43+
44+
</html>

0 commit comments

Comments
 (0)