Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b1e8f93

Browse files
authoredMar 24, 2025··
Update index.html
1 parent 98c1f76 commit b1e8f93

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed
 

‎index.html

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,31 @@
55
<title>Redirecting...</title>
66
<script>
77
window.onload = function() {
8-
// Lấy đường dẫn hiện tại từ URL
9-
var path = window.location.pathname;
8+
// Lấy đường dẫn hiện tại và loại bỏ phần "/easyengine-notes/"
9+
var path = window.location.pathname.replace(/^\/easyengine-notes\//, "/");
1010

11-
// Kiểm tra nếu đường dẫn bắt đầu bằng `/easyengine-notes/`
12-
if (path.startsWith("/easyengine-notes/")) {
13-
// Cắt bỏ đúng phần `/easyengine-notes/`
14-
path = path.substring(17); // 17 là độ dài của "/easyengine-notes/"
15-
16-
// Đảm bảo đường dẫn không bị trống
17-
if (path === "") {
18-
path = "/";
19-
}
11+
// Nếu đường dẫn bị trống sau khi cắt, đặt lại là "/"
12+
if (path === "") {
13+
path = "/";
2014
}
2115

22-
// Tạo URL đích chính xác
16+
// Xây dựng URL mới
2317
var newURL = "https://easyengine-notes.pages.dev" + path + window.location.search;
2418

25-
console.log("Redirecting to:", newURL); // Debug kiểm tra
19+
// Cập nhật lịch sử trình duyệt trước khi redirect
20+
window.history.replaceState(null, "", newURL);
2621

27-
// Chuyển hướng đến URL mới
22+
// Chuyển hướng
2823
window.location.replace(newURL);
2924
};
3025
</script>
3126
</head>
3227
<body>
3328
<p>If you are not redirected, <a id="redirect-link" href="#">click here</a>.</p>
3429
<script>
35-
var path = window.location.pathname;
36-
if (path.startsWith("/easyengine-notes/")) {
37-
path = path.substring(17);
38-
if (path === "") {
39-
path = "/";
40-
}
30+
var path = window.location.pathname.replace(/^\/easyengine-notes\//, "/");
31+
if (path === "") {
32+
path = "/";
4133
}
4234
document.getElementById("redirect-link").href = "https://easyengine-notes.pages.dev" + path + window.location.search;
4335
</script>

0 commit comments

Comments
 (0)
Please sign in to comment.