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

alamb pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/datafusion-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 496d3fc  Try another form of rewrite
496d3fc is described below

commit 496d3fc4a493e92630f74c8ee893eb9a5251e1d0
Author: Andrew Lamb <[email protected]>
AuthorDate: Sat Dec 20 07:03:08 2025 -0500

    Try another form of rewrite
---
 .htaccess | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/.htaccess b/.htaccess
index 43fe0d6..a793ed4 100644
--- a/.htaccess
+++ b/.htaccess
@@ -3,19 +3,25 @@
 # See https://issues.apache.org/jira/browse/INFRA-27512
 RewriteEngine On
 
-# Redirect extensionless, non-output, non-slash URLs to the trailing-slash form
+# Two-step flow:
+# 1) Normalize extensionless URLs to a trailing slash.
+# 2) Internally rewrite all non-output requests into output/.
+
+# Redirect extensionless, non-output URLs to the trailing-slash form
 # (example: /blog/2025/12/15/post -> /blog/2025/12/15/post/).
 RewriteCond %{ENV:REDIRECT_STATUS} ^$
-# Skip URLs already rewritten once to avoid loops (example: /blog/output/...).
-RewriteCond %{REQUEST_URI} !/output/
+# Use THE_REQUEST so the original URL is honored even if server rewrites to 
/output/.
+RewriteCond %{THE_REQUEST} \s+(/[^\s?]+) [NC]
+# Skip URLs already targeting output (example: /blog/output/...).
+RewriteCond %1 !/output/
 # Skip URLs that already end with a slash (example: /blog/2025/12/15/post/).
-RewriteCond %{REQUEST_URI} !/$
+RewriteCond %1 !/$
 # Skip URLs that look like files (have an extension) (example: 
/blog/theme/css/style.css).
-RewriteCond %{REQUEST_URI} !\.[^./]+$
-# Redirect example: /blog/2025/12/15/post -> /blog/2025/12/15/post/
-RewriteRule ^(.+)$ $1/ [R=301,L]
+RewriteCond %1 !\.[^./]+$
+RewriteRule ^.*$ %1/ [R=301,L]
 
-RewriteCond %{ENV:REDIRECT_STATUS} ^$
-# Rewrite all requests to the Pelican output/ directory
+# Rewrite all non-output requests to the Pelican output/ directory
 # (example: /blog/2025/12/15/post/ -> /blog/output/2025/12/15/post/).
+RewriteCond %{ENV:REDIRECT_STATUS} ^$
+RewriteCond %{REQUEST_URI} !/output/
 RewriteRule ^(.*)$ output/$1 [L]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to