You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2022/05/12 05:56:49 UTC

[apisix-website] branch master updated: fix: rm trailing slash (#1083)

This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 2313426bab0 fix: rm trailing slash (#1083)
2313426bab0 is described below

commit 2313426bab058c964614b7c60486f6e640c90853
Author: Young <is...@outlook.com>
AuthorDate: Thu May 12 13:56:44 2022 +0800

    fix: rm trailing slash (#1083)
---
 .htaccess                    | 14 +++++++++++++-
 website/docusaurus.config.js |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/.htaccess b/.htaccess
index 0418b600dfc..d6b5b81df68 100644
--- a/.htaccess
+++ b/.htaccess
@@ -26,4 +26,16 @@ ErrorDocument 404 /404.html
     ExpiresByType application/javascript    "access plus 1 hour"
     ExpiresByType application/json       	"access plus 1 hour"
     ExpiresDefault                  		"access plus 10 days"
-</IfModule>
\ No newline at end of file
+</IfModule>
+
+RewriteEngine on
+
+# Remove trailing slash from non-filepath urls
+RewriteCond %{REQUEST_URI} /(.+)/$
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule ^ https://apisix.apache.org/%1 [R=301,L]
+
+# Include trailing slash on directory 
+RewriteCond %{REQUEST_URI} !(.+)/$
+RewriteCond %{REQUEST_FILENAME} -d
+RewriteRule ^(.+)$ https://apisix.apache.org/$1/ [R=301,L]
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index f4dc6c750c0..a4f94918dfa 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -14,6 +14,7 @@ module.exports = {
     'Apache APISIX is a dynamic, real-time, high-performance Cloud-Native API gateway, based on the Nginx library and etcd.',
   url: 'https://apisix.apache.org',
   baseUrl: '/',
+  trailingSlash: false,
   organizationName: 'Apache',
   projectName: 'apisix-website',
   favicon: 'img/favicon.png',