This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch 2.x-site-stg-out
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/2.x-site-stg-out by this push:
new 76bf36fe53 Fix directory -> file conversions
76bf36fe53 is described below
commit 76bf36fe5381b8adcf4bc70345d0ce5acbc2a23e
Author: Piotr P. Karwasz <[email protected]>
AuthorDate: Fri May 24 22:45:03 2024 +0200
Fix directory -> file conversions
---
.htaccess | 55 ++++++++++++++++++++++++++++++-------------------------
1 file changed, 30 insertions(+), 25 deletions(-)
diff --git a/.htaccess b/.htaccess
index b8ececf675..cebcba523c 100644
--- a/.htaccess
+++ b/.htaccess
@@ -22,42 +22,47 @@ RewriteBase "/log4j/2.x/"
##
# To simplify the redirection rules, we normalized them:
#
-# 1. If the request URIs points to a (non-existent) directory, we add
`index.html` to it
+# 1. If the request URIs ends in `/` (necessarily a `path-info`), we add
`index.html` to it:
RewriteRule "^(.*)/$" "$1/index.html" [DPI]
-# 2. If the request URI points to a (non-existent) file, we make sure it ends
with `.html`:
+# 2. If the request URI points to a (non-existent) file, we try adding `.html`:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 "!\.html$"
RewriteRule "^(.+)$" "$1.html"
#
# From this point rules match against the URI to the real file, with
"/log4j/2.x/" stripped.
-RewriteRule "^log4j-(core|api)/apidocs(.*)$" "javadoc/log4j-$1$2" [R=permanent]
-
# The content moved between pages
+RewriteRule "^log4j-core/apidocs(.*)$" "javadoc/log4j-core$1" [R=permanent]
RewriteRule "^manual/api-separation\.html$" "manual/api.html" [R=permanent]
RewriteRule "^manual/scala-api\.html$" "/log4j/scala/index.html" [R=permanent]
RewriteRule "^manual/usage\.html$" "manual/api.html" [R=permanent]
RewriteRule "^release-notes/index\.html$" "release-notes.html" [R=permanent]
RewriteRule "^runtime-dependencies\.html$" "manual/installation.html"
[R=permanent]
-# Redirect old per-module directories to files
-RewriteRule "^log4j-1\.2-api/index\.html$" "log4j-1.2-api.html" [R=permanent]
-RewriteRule "^log4j-api/index\.html$" "log4j-api.html" [R=permanent]
-RewriteRule "^log4j-appserver/index\.html$" "log4j-appserver.html"
[R=permanent]
-RewriteRule "^log4j-cassandra/index\.html$" "log4j-cassandra.html"
[R=permanent]
-RewriteRule "^log4j-couchdb/index\.html$" "log4j-couchdb.html" [R=permanent]
-RewriteRule "^log4j-docker/index\.html$" "log4j-docker.html" [R=permanent]
-RewriteRule "^log4j-flume-ng/index\.html$" "log4j-flume-ng.html" [R=permanent]
-RewriteRule "^log4j-iostreams/index\.html$" "log4j-iostreams.html"
[R=permanent]
-RewriteRule "^log4j-jakarta-web/index\.html$" "log4j-jakarta-web.html"
[R=permanent]
-RewriteRule "^log4j-jcl/index\.html$" "log4j-jcl.html" [R=permanent]
-RewriteRule "^log4j-jmx-gui/index\.html$" "log4j-jmx-gui.html" [R=permanent]
-RewriteRule "^log4j-jpl/index\.html$" "log4j-jpl.html" [R=permanent]
-RewriteRule "^log4j-jul/index\.html$" "log4j-jul.html" [R=permanent]
-RewriteRule "^log4j-mongodb3/index\.html$" "log4j-mongodb3.html" [R=permanent]
-RewriteRule "^log4j-mongodb4/index\.html$" "log4j-mongodb4.html" [R=permanent]
-RewriteRule "^log4j-slf4j-impl/index\.html$" "log4j-slf4j-impl.html"
[R=permanent]
-RewriteRule "^log4j-slf4j2-impl/index\.html$" "log4j-slf4j2-impl.html"
[R=permanent]
-RewriteRule "^log4j-spring-boot/index\.html$" "log4j-spring-boot.html"
[R=permanent]
-RewriteRule "^log4j-spring-cloud-config/index\.html$"
"log4j-spring-cloud-config.html" [R=permanent]
-RewriteRule "^log4j-spring-cloud-config-client/index\.html$"
"log4j-spring-cloud-config-client.html" [R=permanent]
+# These redirects are special, since:
+#
+# 1. `mod_negotiate` is active and it is applied before `mod_rewrite`,
+# 2. we replaced a directory like `log4j-api/` with a file that has the same
prefix like `log4j-api.html`,
+#
+# if the URI path is `/log4j/2.x/log4j-api/foo` we must match
`log4j-api.html/foo`.
+RewriteRule "^log4j-1\.2-api\.html/" "log4j-1.2-api.html" [R=permanent]
+RewriteRule "^log4j-api\.html/apidocs(.*)$" "javadoc/log4j-api$1" [R=permanent]
+RewriteRule "^log4j-api\.html/index\.html" "log4j-api.html" [R=permanent]
+RewriteRule "^log4j-appserver\.html/index\.html$" "log4j-appserver.html"
[R=permanent]
+RewriteRule "^log4j-cassandra\.html/index\.html$" "log4j-cassandra.html"
[R=permanent]
+RewriteRule "^log4j-couchdb\.html/index\.html$" "log4j-couchdb.html"
[R=permanent]
+RewriteRule "^log4j-docker\.html/index\.html$" "log4j-docker.html"
[R=permanent]
+RewriteRule "^log4j-flume-ng\.html/index\.html$" "log4j-flume-ng.html"
[R=permanent]
+RewriteRule "^log4j-iostreams\.html/index\.html$" "log4j-iostreams.html"
[R=permanent]
+RewriteRule "^log4j-jakarta-web\.html/index\.html$" "log4j-jakarta-web.html"
[R=permanent]
+RewriteRule "^log4j-jcl\.html/index\.html$" "log4j-jcl.html" [R=permanent]
+RewriteRule "^log4j-jmx-gui\.html/index\.html$" "log4j-jmx-gui.html"
[R=permanent]
+RewriteRule "^log4j-jpl\.html/index\.html$" "log4j-jpl.html" [R=permanent]
+RewriteRule "^log4j-jul\.html/index\.html$" "log4j-jul.html" [R=permanent]
+RewriteRule "^log4j-mongodb3\.html/index\.html$" "log4j-mongodb3.html"
[R=permanent]
+RewriteRule "^log4j-mongodb4\.html/index\.html$" "log4j-mongodb4.html"
[R=permanent]
+RewriteRule "^log4j-slf4j-impl\.html/index\.html$" "log4j-slf4j-impl.html"
[R=permanent]
+RewriteRule "^log4j-slf4j2-impl\.html/index\.html$" "log4j-slf4j2-impl.html"
[R=permanent]
+RewriteRule "^log4j-spring-boot\.html/index\.html$" "log4j-spring-boot.html"
[R=permanent]
+RewriteRule "^log4j-spring-cloud-config\.html/index\.html$"
"log4j-spring-cloud-config.html" [R=permanent]
+RewriteRule "^log4j-spring-cloud-config-client\.html/index\.html$"
"log4j-spring-cloud-config-client.html" [R=permanent]