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

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


The following commit(s) were added to refs/heads/master by this push:
     new ffa3d08752 Update .htaccess
ffa3d08752 is described below

commit ffa3d08752e40499ea699ebb614d06f000d86722
Author: Albumen Kevin <[email protected]>
AuthorDate: Thu Apr 14 11:22:12 2022 +0800

    Update .htaccess
---
 .htaccess | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/.htaccess b/.htaccess
index efc131a97e..621ba74f1d 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,9 +1,29 @@
+# no cahce for root index redirection
+<If "%{REQUEST_URI} =~ m#^/?([\w\-]+\.html)?$#">
+    <IfModule mod_expires.c>
+        ExpiresActive off
+    </IfModule>
+
+    <IfModule mod_headers.c>
+        Header always set Cache-Control "no-store, no-cache, must-revalidate"
+        Header always set Expires "Thu, 01 Dec 1994 16:00:00 GMT"
+        Header always merge Vary "Accept-Language"
+    </IfModule>
+</If>
+
 <IfModule mod_rewrite.c>
-RewriteEngine On
-RewriteCond %{SERVER_PORT} !^443$
-RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
+  RewriteEngine On
+  RewriteCond %{SERVER_PORT} !^443$
+  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
+
+  RewriteCond "%{HTTP:Accept-Language}" ^zh [NC]
+  RewriteRule ^/?(index\.html)?$ "/zh/index.html" [L,R=302]
+
+  RewriteRule ^/?(index\.html)?$ "/en/index.html" [L,R=302]
 
+  RewriteCond "%{HTTP:Accept-Language}" ^zh [NC]
+  RewriteRule ^/?([\w\-]+)\.html$ "/zh/$1.html" [L,R=302]
 
-RewriteRule ^/$ /en [L,R=301]
+  RewriteRule ^/?([\w\-]+)\.html$ "/en/$1.html" [L,R=302]
 
 </IfModule>

Reply via email to