-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path404.html
More file actions
25 lines (23 loc) · 727 Bytes
/
404.html
File metadata and controls
25 lines (23 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html>
<head>
<title>My Angular App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script>
// Extract the path from the URL
var path = window.location.pathname.replace(/\/+/, '');
// Define the routes you want to handle
var validRoutes = ['contact', 'blog', 'home', 'about']; // Add more routes if needed
// Check if the current path is a valid route
if (validRoutes.includes(path)) {
// Redirect to the index.html with the path appended
window.location.replace('index.html#' + path);
} else {
// Redirect to the default index.html
window.location.replace('index.html');
}
</script>
</body>
</html>