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 123a5fc808 Fix redirects from empty directories (3)
123a5fc808 is described below
commit 123a5fc8081b097ad30d620b0435b27c89bbcd86
Author: Piotr P. Karwasz <[email protected]>
AuthorDate: Fri May 24 20:57:27 2024 +0200
Fix redirects from empty directories (3)
---
.htaccess | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000000..b8ececf675
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,63 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+RewriteEngine On
+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
+RewriteRule "^(.*)/$" "$1/index.html" [DPI]
+# 2. If the request URI points to a (non-existent) file, we make sure it ends
with `.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 "^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]