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

skrawcz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/burr.git


The following commit(s) were added to refs/heads/main by this push:
     new 9da8f294 fix: deploy .htaccess and add HTML redirect fallbacks for old 
doc paths (#686)
9da8f294 is described below

commit 9da8f2949ace716933451381e0be614fba238c0b
Author: AndrĂ© Ahlert <[email protected]>
AuthorDate: Thu Mar 19 03:32:09 2026 -0300

    fix: deploy .htaccess and add HTML redirect fallbacks for old doc paths 
(#686)
    
    The deploy step used `cp -r ... /*` which skips dotfiles, so .htaccess
    was never copied to the asf-site branch. Add `shopt -s dotglob` to fix.
    
    Also generate static HTML redirect pages by scanning the Sphinx build
    output at build time, as fallback in case ASF infra does not process
    .htaccess. See PR #679 for context.
---
 .github/workflows/build-site.yml | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/.github/workflows/build-site.yml b/.github/workflows/build-site.yml
index af47db0e..85816a04 100644
--- a/.github/workflows/build-site.yml
+++ b/.github/workflows/build-site.yml
@@ -99,6 +99,42 @@ jobs:
         echo "Docs:"
         ls -la /tmp/site-output/docs/ | head -20
 
+    # TODO: Remove this step once we confirm ASF infra honors .htaccess 
(AllowOverride).
+    # This was added as a fallback for PR #679 (landing page migration) 
because:
+    # The .htaccess was not being deployed (dotglob fix above solves this) and
+    # ASF infra may not honor .htaccess for the publish serving mode in 
.asf.yaml.
+    # Once confirmed, the .htaccess 301s are sufficient and these static HTML
+    # redirects can be removed to avoid bloating the asf-site branch.
+    - name: Generate HTML redirect fallbacks
+      run: |
+        # Scan Sphinx build output and generate static HTML redirects for 
every page.
+        # These act as fallback if the server does not process .htaccess.
+        BASE_URL="https://burr.apache.org";
+        OUTPUT="/tmp/site-output"
+        DOCS_BUILD="docs/_build/html"
+        COUNT=0
+
+        # Find every index.html in the Sphinx output (dirhtml builder creates 
dir/index.html per page)
+        while IFS= read -r file; do
+          # Get path relative to build root, e.g. 
"getting_started/install/index.html"
+          rel="${file#$DOCS_BUILD/}"
+          dir="$(dirname "$rel")"
+
+          # Skip the docs root (landing page lives there) and paths already in 
site output
+          if [ "$dir" = "." ] || [ -e "$OUTPUT/$dir/index.html" ]; then
+            continue
+          fi
+
+          target="$BASE_URL/docs/$dir/"
+          mkdir -p "$OUTPUT/$dir"
+          printf '<!DOCTYPE html><html><head>\n<meta charset="utf-8">\n<meta 
http-equiv="refresh" content="0; url=%s">\n<link rel="canonical" 
href="%s">\n<script>window.location.replace("%s")</script>\n</head><body>Redirecting
 to <a href="%s">%s</a>...</body></html>\n' \
+            "$target" "$target" "$target" "$target" "$target" \
+            > "$OUTPUT/$dir/index.html"
+          COUNT=$((COUNT + 1))
+        done < <(find "$DOCS_BUILD" -name "index.html" -type f)
+
+        echo "Generated $COUNT HTML redirect fallbacks."
+
     - name: Deploy to asf-site / asf-staging
       if: github.event_name != 'pull_request'
       run: |
@@ -126,6 +162,7 @@ jobs:
 
         rm -rf /tmp/gh-pages/content
         mkdir -p /tmp/gh-pages/content
+        shopt -s dotglob
         cp -r /tmp/site-output/* /tmp/gh-pages/content/
 
         cd /tmp/gh-pages

Reply via email to