Skip to content

Commit 00a3cd2

Browse files
author
Yassine El Haddad
authored
Merge pull request #201 from yel-hadd/master
Update 404 Not Found Page, Add new redirections
2 parents 058ef4c + 6e9a140 commit 00a3cd2

4 files changed

Lines changed: 73 additions & 103 deletions

File tree

docs/.vuepress/public/not-found.html

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -68,51 +68,51 @@ <h1 class="display-1">404</h1>
6868
</div>
6969
<script>
7070
var data = [
71-
{
72-
"title": "Introduction to Cloudlinux OS",
73-
"description": "Introduction to CloudLinux OS editions and their description.",
74-
"link": "/introduction/"
75-
},
76-
{
77-
"title": "CloudLinux OS Legacy (Shared)",
78-
"description": "CloudLinux OS Legacy (Shared) is designed for shared hosting providers. It isolates each customer into a separate “Lightweight Virtualized Environment” (LVE), which allocates and limits server resources.",
79-
"link": "/legacy/cloudlinux_installation/"
80-
},
81-
{
82-
"title": "CloudLinux OS Shared Pro",
83-
"description": "CloudLinux OS Shared Pro extends your CloudLinux OS Legacy (Shared) functionality with even more useful features.",
84-
"link": "/shared-pro/introduction/"
85-
},
86-
{
87-
"title": "AccelerateWP",
88-
"description": "AccelerateWP carries a suite of optimization features that can be enabled and automatically configured for the end user's site.",
89-
"link": "/shared-pro/accelerate-wp/"
90-
},
91-
{
92-
"title": "CLN",
93-
"description": "CLN is a CloudLinux Network designed to easily manage your licenses of CloudLinux products and services by means of a user-friendly interface.",
94-
"link": "/cln/introduction/"
95-
},
96-
{
97-
"title": "CloudLinux Solo",
98-
"description": "CloudLinux OS Solo is designed for VPS or dedicated servers with a single hosting account for any number of websites.",
99-
"link": "/solo/introduction/"
100-
},
101-
{
102-
"title": "CloudLinux OS Admin",
103-
"description": "CloudLinux OS Admin is designed for shared hosting providers and allows flawless migration of big shared hosting customers to individual VPS with the same CloudLinux features as on shared hosting.",
104-
"link": "/admin/description"
105-
},
106-
{
107-
"title": "CloudLinux Subsystem For Ubuntu",
108-
"description": "CloudLinux subsystem on Ubuntu is a scope of deb-packages that allows using CloudLinux features on Ubuntu OS.",
109-
"link": "/ubuntu/introduction/"
110-
},
111-
{
112-
"title": "End-user Documents",
113-
"description": "Documentation section for end-users on Cloudlinux OS.",
114-
"link": "/user-docs/user-docs-shared-cloudlinux/"
115-
}
71+
{
72+
title: "Introduction to Cloudlinux OS",
73+
description: "Introduction to CloudLinux OS editions and their description.",
74+
link: "/introduction/",
75+
},
76+
{
77+
title: "CloudLinux OS",
78+
description: "Optimizes shared hosting environments by enhancing stability, security, and performance through user isolation and efficient resource management. Featuring tools like LVE resource limits, CageFS, and multiple language selectors, it empowers hosting providers to offer superior services. The CloudLinux OS Shared Pro edition further extends functionality with even more valuable features.",
79+
link: "/cloudlinuxos/cloudlinux_installation/",
80+
},
81+
{
82+
title: "Apache2Nginx (BETA)",
83+
description: "Apache2Nginx sets up Nginx hosting with .htaccess support.",
84+
link: "/cloudlinuxos/apache2nginx/",
85+
},
86+
{
87+
title: "AccelerateWP",
88+
description: "AccelerateWP carries a suite of optimization features that can be enabled and automatically configured for the end user's site.",
89+
link: "/cloudlinuxos/shared-pro/accelerate-wp/",
90+
},
91+
{
92+
title: "CLN - CloudLinux Licenses",
93+
description: "CLN is a CloudLinux Network designed to easily manage your licenses of CloudLinux products and services by means of a user-friendly interface.",
94+
link: "/cln/introduction/",
95+
},
96+
{
97+
title: "CloudLinux Solo",
98+
description: "CloudLinux OS Solo is designed for VPS or dedicated servers with a single hosting account for any number of websites.",
99+
link: "/solo/introduction/",
100+
},
101+
{
102+
title: "CloudLinux OS Admin",
103+
description: "CloudLinux OS Admin is designed for shared hosting providers and allows flawless migration of big shared hosting customers to individual VPS with the same CloudLinux features as on shared hosting.",
104+
link: "/admin/description/",
105+
},
106+
{
107+
title: "CloudLinux Subsystem For Ubuntu",
108+
description: "CloudLinux subsystem on Ubuntu is a scope of deb-packages that allows using CloudLinux features on Ubuntu OS.",
109+
link: "/ubuntu/introduction/",
110+
},
111+
{
112+
title: "End-user Documents",
113+
description: "Documentation section for end-users on Cloudlinux OS.",
114+
link: "/user-docs/user-docs-shared-pro-cloudlinux/",
115+
}
116116
];
117117
$(document).ready(function() {
118118
var row = '<div class="row">';

docs/.vuepress/routes.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,7 @@
4949
"/user-docs/user-docs-shared-cloudlinux/#acceleratewp":"/user-docs/user-docs-shared-pro-cloudlinux/#acceleratewp",
5050
"/cloudlinux-os-plus":"/cloudlinuxos/shared-pro/",
5151
"/cloudlinuxos": "/cloudlinuxos/cloudlinux_installation/#installation",
52-
"/shared": "/cloudlinuxos/"
52+
"/shared": "/cloudlinuxos/",
53+
"/shared-pro/accelerate-wp/#set-upgrade-url-for-cdn": "/cloudlinuxos/shared-pro/#set-upgrade-url-for-cdn",
54+
"/shared-pro/accelerate-wp": "/cloudlinuxos/shared-pro/#acceleratewp"
5355
}
Lines changed: 25 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,58 @@
11
<template>
22
<div class="custom-container">
3+
<iframe v-if="showIframe" :src="iframeSrc" style="width: 100%; height: 100vh; border: none;"></iframe>
34
</div>
45
</template>
56

6-
77
<script setup>
88
import { useRoute, useRouter } from "vue-router";
99
import { onMounted, ref } from "vue";
1010
import { pagesData } from "../../.temp/internal/pagesData.js";
11-
import redirects from './redirects.json';
1211
1312
const route = useRoute();
1413
const router = useRouter();
15-
const allPages = ref([]);
16-
17-
// Function to escape special characters in a string for use in a regular expression
18-
function escapeRegExp(string) {
19-
return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&');
20-
}
21-
22-
const redirectionURL = async () => {
23-
if (route.path.startsWith('/index.html?')) {
24-
// Extract the part after the ?
25-
const key = route.path.split('?')[1];
26-
// Check if this key exists in the redirects
27-
if (key in redirects) {
28-
// If it does, redirect to the associated path
29-
router.push(redirects[key]);
30-
return true;
31-
}
32-
}
33-
34-
for (let [from, to] of Object.entries(redirects)) {
35-
// Existing code for paths without special characters
36-
const escapedFrom = escapeRegExp(from);
37-
if (route.path.search(escapedFrom) !== -1) {
38-
const path = route.path.replace(new RegExp(escapedFrom, 'g'), to);
39-
// If match is found, return true
40-
router.push(path);
41-
return true;
42-
}
43-
}
44-
// If no match is found, return false
45-
return false;
46-
};
14+
const showIframe = ref(false);
15+
const iframeSrc = ref("");
4716
4817
const getRecursiveLevelPath = (child, rootPath) => {
4918
let haveSolution = false;
5019
5120
if (haveSolution) return;
5221
53-
if(child.children?.length > 0) {
22+
if (child.children?.length > 0) {
5423
for (let h of child.children) {
55-
const path = rootPath + "/" + h.link
24+
const path = rootPath + "/" + h.link;
5625
5726
if (path.search(route.path) !== -1) {
58-
router.push(path)
59-
haveSolution = true
27+
router.push(path);
28+
haveSolution = true;
6029
return;
6130
}
6231
6332
if (child.children.length > 0) {
64-
getRecursiveLevelPath(h, rootPath)
33+
getRecursiveLevelPath(h, rootPath);
6534
}
6635
}
6736
}
6837
};
6938
7039
onMounted(async () => {
71-
// If a redirect was performed, stop checking the other techniques
72-
if (await redirectionURL()) {
73-
return;
74-
}
75-
76-
// If no match found in JSON redirects, then check the existing techniques
7740
const values = Object?.values(pagesData);
7841
7942
for (let value of values) {
8043
const res = await value();
81-
8244
let rootPath = res.path;
8345
84-
if (rootPath.at(-1) === "/")
46+
if (rootPath.at(-1) === "/") {
8547
rootPath = rootPath.slice(0, -1);
48+
}
8649
87-
if(res.headers?.length > 0) {
50+
if (res.headers?.length > 0) {
8851
for (let h of res.headers) {
89-
const path = rootPath + "/" + h.link
52+
const path = rootPath + "/" + h.link;
9053
91-
if (path.search(route.path) !== -1){
92-
router.push(path)
54+
if (path.search(route.path) !== -1) {
55+
router.push(path);
9356
return;
9457
}
9558
getRecursiveLevelPath(h, rootPath);
@@ -99,15 +62,23 @@ onMounted(async () => {
9962
10063
if (route.fullPath.startsWith('/legacy')) {
10164
const newPath = route.fullPath.replace('/legacy', '/cloudlinuxos');
102-
// router.push(newPath);
10365
window.location.href = newPath;
10466
} else if (route.fullPath.startsWith('/shared')) {
10567
const newPath = route.fullPath.replace('/shared', '/cloudlinuxos');
10668
router.push(newPath);
10769
window.location.href = newPath;
10870
} else {
109-
window.location.href = '/not-found.html';
71+
// Show the iframe and set the source to 'not-found.html'
72+
showIframe.value = true;
73+
iframeSrc.value = '/not-found.html';
11074
}
111-
11275
});
11376
</script>
77+
78+
<style>
79+
.custom-container {
80+
position: relative;
81+
width: 100%;
82+
height: 100vh;
83+
}
84+
</style>

docs/.vuepress/theme/layouts/redirects.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)