This is an automated email from the ASF dual-hosted git repository.
janhoy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-site.git
The following commit(s) were added to refs/heads/main by this push:
new 714b008 SOLR-15557 Separate htaccess file in guide/ subdirectory
714b008 is described below
commit 714b0089513b7bfb8c21802d54432881b990b4e9
Author: Jan Høydahl <[email protected]>
AuthorDate: Sun Feb 6 00:48:56 2022 +0100
SOLR-15557 Separate htaccess file in guide/ subdirectory
---
themes/solr/templates/guide/.htaccess | 32 ++++++++++++++++++++++++++++++++
themes/solr/templates/htaccess.template | 8 +++-----
2 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/themes/solr/templates/guide/.htaccess
b/themes/solr/templates/guide/.htaccess
new file mode 100644
index 0000000..0284765
--- /dev/null
+++ b/themes/solr/templates/guide/.htaccess
@@ -0,0 +1,32 @@
+# 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
+
+# Test of page rename redirects
+RewriteRule foo.html solr-glossary.html [R=301,NE,L]
+RewriteRule bar.html 8_0/solr-glossary.html [R=301,NE,L]
+
+# Simple redirect to "directory", so later rules match
+RedirectMatch Permanent ^\d+_\d+$ $0/
+
+# Redirect to latest guide version, e.g. /guide/foo.html is redirected to
latest guide /guide/X_Y/foo.html
+RedirectMatch temp ^(?!index.html)([a-z].*) {{ SOLR_LATEST_RELEASE.rsplit(".",
1) | first | replace(".", "_") }}/$1
+
+# Hack: Append slash, if folder name does not end with slash - everything
containing a "." is treated as file and excluded from redirect:
+RewriteRule ^\d+(?!.+\.\w+$|.+/$).+$ $0/ [R=301,L]
+
+# __root/docs.solr.apache.org/ is a special alias added by INFRA-19439, so we
can refer to stuff in other places like SVN
+RewriteRule ^\d+.*$ __root/docs.solr.apache.org/$0 [PT]
diff --git a/themes/solr/templates/htaccess.template
b/themes/solr/templates/htaccess.template
index 463ec0c..c96e993 100644
--- a/themes/solr/templates/htaccess.template
+++ b/themes/solr/templates/htaccess.template
@@ -52,14 +52,12 @@ RedirectMatch Permanent ^/(\d+_\d+_\d+/.*)$ /docs/$1
# Simple redirect to "directory", so later rules match
RedirectMatch temp ^/api$ $0/
RedirectMatch Permanent ^/docs/\d+_\d+_\d+$ $0/
-RedirectMatch Permanent ^/guide/\d+_\d+$ $0/
# Other pages can always be redirected to the "most current" released javadocs
# using "temp" instead of permanent so crawlers know that they
# might change again in the future
RedirectMatch temp ^/api/org/(.*) /docs/{{ SOLR_LATEST_RELEASE | replace(".",
"_") }}/solr-core/org/$1
RedirectMatch temp ^/api/(.*) /docs/{{ SOLR_LATEST_RELEASE | replace(".", "_")
}}/$1
-RedirectMatch temp ^/guide/(?!index.html)([a-z].*) /guide/{{
SOLR_LATEST_RELEASE.rsplit(".", 1) | first | replace(".", "_") }}/$1
# Solr Tutorial is now in the Solr Ref Guide
# should redirect automatically to latest version
@@ -73,10 +71,10 @@ RedirectMatch Permanent ^/docs/api-(.*) /docs/$1
Redirect temp /charts https://nightlies.apache.org/solr/release/helm-charts
Redirect temp /operator/downloads/crds
https://nightlies.apache.org/solr/release/operator/crds
-### Javadocs & Refguide
+### Javadocs
# Hack: Append slash, if folder name does not end with slash - everything
containing a "." is treated as file and excluded from redirect:
-RewriteRule ^(docs|guide)/\d+(?!.+\.\w+$|.+/$).+$ $0/ [R=301,L]
+RewriteRule ^docs/\d+(?!.+\.\w+$|.+/$).+$ $0/ [R=301,L]
# __root/docs.solr.apache.org/ is a special alias added by INFRA-19439, so we
can refer to stuff in other places like SVN
-RewriteRule ^(docs|guide)/\d+.*$ __root/docs.solr.apache.org/$0 [PT]
+RewriteRule ^docs/\d+.*$ __root/docs.solr.apache.org/$0 [PT]