diff --git a/docs/en/cookbook/index.html b/docs/en/cookbook/index.html
index 2ea7169e..0c816fb8 100644
--- a/docs/en/cookbook/index.html
+++ b/docs/en/cookbook/index.html
@@ -1,10 +1,10 @@
-
+
Cookbook - cpp-httplib
-
+
+
diff --git a/docs/en/index.html b/docs/en/index.html
index 15130960..b8ce7b79 100644
--- a/docs/en/index.html
+++ b/docs/en/index.html
@@ -1,10 +1,10 @@
-
+
cpp-httplib - cpp-httplib
-
+
+
diff --git a/docs/en/tour/01-getting-started/index.html b/docs/en/tour/01-getting-started/index.html
index 947de1a0..4a42f735 100644
--- a/docs/en/tour/01-getting-started/index.html
+++ b/docs/en/tour/01-getting-started/index.html
@@ -1,10 +1,10 @@
-
+
Getting Started - cpp-httplib
-
+
+
diff --git a/docs/en/tour/02-basic-client/index.html b/docs/en/tour/02-basic-client/index.html
index 57f07ae1..e0f60cfe 100644
--- a/docs/en/tour/02-basic-client/index.html
+++ b/docs/en/tour/02-basic-client/index.html
@@ -1,10 +1,10 @@
-
+
Basic Client - cpp-httplib
-
+
+
diff --git a/docs/en/tour/03-basic-server/index.html b/docs/en/tour/03-basic-server/index.html
index a4d9dcf7..f173c41d 100644
--- a/docs/en/tour/03-basic-server/index.html
+++ b/docs/en/tour/03-basic-server/index.html
@@ -1,10 +1,10 @@
-
+
Basic Server - cpp-httplib
-
+
+
diff --git a/docs/en/tour/04-static-file-server/index.html b/docs/en/tour/04-static-file-server/index.html
index 3f1d5b6d..75a07065 100644
--- a/docs/en/tour/04-static-file-server/index.html
+++ b/docs/en/tour/04-static-file-server/index.html
@@ -1,10 +1,10 @@
-
+
Static File Server - cpp-httplib
-
+
+
diff --git a/docs/en/tour/05-tls-setup/index.html b/docs/en/tour/05-tls-setup/index.html
index 0910368c..9fe13956 100644
--- a/docs/en/tour/05-tls-setup/index.html
+++ b/docs/en/tour/05-tls-setup/index.html
@@ -1,10 +1,10 @@
-
+
TLS Setup - cpp-httplib
-
+
+
diff --git a/docs/en/tour/06-https-client/index.html b/docs/en/tour/06-https-client/index.html
index 8d68febe..62a59b7b 100644
--- a/docs/en/tour/06-https-client/index.html
+++ b/docs/en/tour/06-https-client/index.html
@@ -1,10 +1,10 @@
-
+
HTTPS Client - cpp-httplib
-
+
+
diff --git a/docs/en/tour/07-https-server/index.html b/docs/en/tour/07-https-server/index.html
index 1819647d..8852658a 100644
--- a/docs/en/tour/07-https-server/index.html
+++ b/docs/en/tour/07-https-server/index.html
@@ -1,10 +1,10 @@
-
+
HTTPS Server - cpp-httplib
-
+
+
diff --git a/docs/en/tour/08-websocket/index.html b/docs/en/tour/08-websocket/index.html
index 57854c4b..66eca197 100644
--- a/docs/en/tour/08-websocket/index.html
+++ b/docs/en/tour/08-websocket/index.html
@@ -1,10 +1,10 @@
-
+
WebSocket - cpp-httplib
-
+
+
diff --git a/docs/en/tour/09-whats-next/index.html b/docs/en/tour/09-whats-next/index.html
index 9519f9fe..4f235519 100644
--- a/docs/en/tour/09-whats-next/index.html
+++ b/docs/en/tour/09-whats-next/index.html
@@ -1,10 +1,10 @@
-
+
What's Next - cpp-httplib
-
+
+
diff --git a/docs/en/tour/index.html b/docs/en/tour/index.html
index ce8502e9..e2c8de26 100644
--- a/docs/en/tour/index.html
+++ b/docs/en/tour/index.html
@@ -1,10 +1,10 @@
-
+
A Tour of cpp-httplib - cpp-httplib
-
+
+
diff --git a/docs/index.html b/docs/index.html
index 7362714a..a6c85f30 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -5,13 +5,13 @@
-
+
Redirecting...
-Redirecting to /en/...
+Redirecting to /cpp-httplib/en/...
\ No newline at end of file
diff --git a/docs/ja/cookbook/index.html b/docs/ja/cookbook/index.html
index 5fd34c28..92980a87 100644
--- a/docs/ja/cookbook/index.html
+++ b/docs/ja/cookbook/index.html
@@ -1,10 +1,10 @@
-
+
Cookbook - cpp-httplib
-
+
+
diff --git a/docs/ja/index.html b/docs/ja/index.html
index d4e61d2f..4fd41bcb 100644
--- a/docs/ja/index.html
+++ b/docs/ja/index.html
@@ -1,10 +1,10 @@
-
+
cpp-httplib - cpp-httplib
-
+
+
diff --git a/docs/ja/tour/01-getting-started/index.html b/docs/ja/tour/01-getting-started/index.html
index 0ba405f8..29eee123 100644
--- a/docs/ja/tour/01-getting-started/index.html
+++ b/docs/ja/tour/01-getting-started/index.html
@@ -1,10 +1,10 @@
-
+
Getting Started - cpp-httplib
-
+
+
diff --git a/docs/ja/tour/02-basic-client/index.html b/docs/ja/tour/02-basic-client/index.html
index aa243dfa..ed178e87 100644
--- a/docs/ja/tour/02-basic-client/index.html
+++ b/docs/ja/tour/02-basic-client/index.html
@@ -1,10 +1,10 @@
-
+
Basic Client - cpp-httplib
-
+
+
diff --git a/docs/ja/tour/03-basic-server/index.html b/docs/ja/tour/03-basic-server/index.html
index 9c0493bf..89d70c7e 100644
--- a/docs/ja/tour/03-basic-server/index.html
+++ b/docs/ja/tour/03-basic-server/index.html
@@ -1,10 +1,10 @@
-
+
Basic Server - cpp-httplib
-
+
+
diff --git a/docs/ja/tour/04-static-file-server/index.html b/docs/ja/tour/04-static-file-server/index.html
index 206f1d06..38156261 100644
--- a/docs/ja/tour/04-static-file-server/index.html
+++ b/docs/ja/tour/04-static-file-server/index.html
@@ -1,10 +1,10 @@
-
+
Static File Server - cpp-httplib
-
+
+
diff --git a/docs/ja/tour/05-tls-setup/index.html b/docs/ja/tour/05-tls-setup/index.html
index 908bba98..af0ee31a 100644
--- a/docs/ja/tour/05-tls-setup/index.html
+++ b/docs/ja/tour/05-tls-setup/index.html
@@ -1,10 +1,10 @@
-
+
TLS Setup - cpp-httplib
-
+
+
diff --git a/docs/ja/tour/06-https-client/index.html b/docs/ja/tour/06-https-client/index.html
index fbbfd3da..3deaf311 100644
--- a/docs/ja/tour/06-https-client/index.html
+++ b/docs/ja/tour/06-https-client/index.html
@@ -1,10 +1,10 @@
-
+
HTTPS Client - cpp-httplib
-
+
+
diff --git a/docs/ja/tour/07-https-server/index.html b/docs/ja/tour/07-https-server/index.html
index 2ed95e24..e5b65672 100644
--- a/docs/ja/tour/07-https-server/index.html
+++ b/docs/ja/tour/07-https-server/index.html
@@ -1,10 +1,10 @@
-
+
HTTPS Server - cpp-httplib
-
+
+
diff --git a/docs/ja/tour/08-websocket/index.html b/docs/ja/tour/08-websocket/index.html
index 85903d2f..8ec05f06 100644
--- a/docs/ja/tour/08-websocket/index.html
+++ b/docs/ja/tour/08-websocket/index.html
@@ -1,10 +1,10 @@
-
+
WebSocket - cpp-httplib
-
+
+
diff --git a/docs/ja/tour/09-whats-next/index.html b/docs/ja/tour/09-whats-next/index.html
index c3b22f47..2be22036 100644
--- a/docs/ja/tour/09-whats-next/index.html
+++ b/docs/ja/tour/09-whats-next/index.html
@@ -1,10 +1,10 @@
-
+
What's Next - cpp-httplib
-
+
+
diff --git a/docs/ja/tour/index.html b/docs/ja/tour/index.html
index 50246777..dee48972 100644
--- a/docs/ja/tour/index.html
+++ b/docs/ja/tour/index.html
@@ -1,10 +1,10 @@
-
+
A Tour of cpp-httplib - cpp-httplib
-
+
+
diff --git a/docs/js/main.js b/docs/js/main.js
index 3bdb6bb2..5ed3fbe3 100644
--- a/docs/js/main.js
+++ b/docs/js/main.js
@@ -19,8 +19,11 @@
e.preventDefault();
var lang = link.getAttribute('data-lang');
localStorage.setItem('preferred-lang', lang);
+ var basePath = document.documentElement.getAttribute('data-base-path') || '';
var path = window.location.pathname;
- var newPath = path.replace(/^\/[a-z]{2}\//, '/' + lang + '/');
+ // Strip base path prefix, replace lang, then re-add base path
+ var pathWithoutBase = path.slice(basePath.length);
+ var newPath = basePath + pathWithoutBase.replace(/^\/[a-z]{2}\//, '/' + lang + '/');
window.location.href = newPath;
});
})();