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

mck pushed a commit to branch asf-staging
in repository https://gitbox.apache.org/repos/asf/cassandra-website.git


The following commit(s) were added to refs/heads/asf-staging by this push:
     new de3465f  Add a redirect for 404 pages, to onee level up
de3465f is described below

commit de3465f98d683a3ec040187b17ab20300915bfcc
Author: mck <m...@apache.org>
AuthorDate: Tue Aug 3 21:03:06 2021 +0200

    Add a redirect for 404 pages, to onee level up
---
 content/.htaccess | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/content/.htaccess b/content/.htaccess
index c87afe0..dee187e 100755
--- a/content/.htaccess
+++ b/content/.htaccess
@@ -1,17 +1,19 @@
-RewriteEngine On
+<IfModule mod_rewrite.c>
+    RewriteEngine On
 
-RewriteCond %{HTTPS} !=on
-RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
+    # always https
+    RewriteCond %{HTTPS} !=on
+    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
 
-RedirectMatch 301 "^/$" "/_/index.html"
+    # frontpage
+    RedirectMatch 301 "^/$" "/_/index.html"
 
-RewriteCond %{REQUEST_URI} !^/doc/.*
-RewriteCond %{REQUEST_URI} ^(.*)/$
-RewriteRule ^(.*)/$ /_/$1.html [R=301,L]
+    # redirect old style URLs into .html new format
+    RewriteCond %{REQUEST_URI} !^/doc/.*
+    RewriteCond %{REQUEST_URI} ^(.*)/$
+    RewriteRule ^(.*)/$ /_/$1.html [R=301,L]
 
 
-<IfModule mod_rewrite.c>
-    RewriteEngine on
     Redirect 301 /blog.html /_/blog.html
     Redirect 301 /blog/2021/04/19/cass-world-party-speakers.html 
/blog/Speakers-Announced-for-April-28-Cassandra-4.0-World-Party.html
     Redirect 301 /blog/2021/04/12/cass-changelog_6.html 
/blog/Apache-Cassandra-Changelog-6-April-2021.html
@@ -32,4 +34,10 @@ RewriteRule ^(.*)/$ /_/$1.html [R=301,L]
     Redirect 301 
/blog/2018/10/17/finding_bugs_with_property_based_testing.html 
/blog/Finding-Bugs-in-Cassandra's-Internals-with-Property-based-Testing.html
     Redirect 301 /blog/2018/08/21/testing_apache_cassandra.html 
/blog/Testing-Apache-Cassandra-4.html
     Redirect 301 /blog/2018/08/07/faster_streaming_in_cassandra.html 
/blog/Hardware-bound-Zero-Copy-Streaming-in-Apache-Cassandra-4.html
+
+    ## if current file/directory doesn't exist then
+    ## forward to the parent directory of the current REQUEST_URI
+    RewriteCond %{DOCUMENT_ROOT}/$0 !-f
+    RewriteCond %{DOCUMENT_ROOT}/$0 !-d
+    RewriteRule ^(?:(.+?)/)?[^/]+/?$ /$1 [L,NE,R=302]
 </IfModule>

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to