blob: fdcd369b5a5aabc95ee099166aa331b9e65c21c7 [file] [log] [blame]
# 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 /
<If "%{HTTPS} == 'on'">
Header always set Strict-Transport-Security "max-age=31536000"
</If>
<Else>
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</Else>
### Pre-CMS site redirects
# DOAP file redirects to source repository
RedirectMatch Permanent ^/doap/solr.rdf https://gitbox.apache.org/repos/asf?p=solr.git;a=blob_plain;f=dev-tools/doap/solr.rdf;hb=HEAD
# Solr site redesign
# needs to use mod_rewrite because of the anchor fragments
RewriteRule ^books.html resources.html#solr-books [R=301,NE,L]
RewriteRule ^discussion.html community.html#mailing-lists-chat [R=301,NE,L]
RewriteRule ^documentation.html resources.html#documentation [R=301,NE,L]
RewriteRule ^screenshots.html features.html [R=301,NE,L]
RewriteRule ^solrnews.html news.html [R=301,NE,L]
RewriteRule ^tutorial.html resources.html#tutorials [R=301,NE,L]
RewriteRule ^versioncontrol.html resources.html#solr-version-control [R=301,NE,L]
RewriteRule ^version_control.html resources.html#solr-version-control [R=301,NE,L]
RewriteRule ^mailing_lists.html community.html#mailing-lists-chat [R=301,NE,L]
RewriteRule ^mirrors-solr-latest-redir.html downloads.html [R=301,NE,L]
RewriteRule ^mirrors-solr-3x-redir downloads.html [R=301,NE,L]
RewriteRule ^mirrors-solr-redir.html downloads.html [R=301,NE,L]
RedirectMatch Permanent ^/issue_tracking.html https://issues.apache.org/jira/browse/SOLR
# Top-level javadoc redirect in case redirected from Lucene site /solr/X_Y_Z -> solr.apache.org/x_Y_Z
RedirectMatch Permanent ^/(\d+_\d+_\d+)$ /docs/$1/
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
RedirectMatch Permanent ^/quickstart.html /guide/solr-tutorial.html
# redirect older point versions to latest (to keep number of javadocs small):
RedirectMatch Permanent ^/docs/4_0_0-(ALPHA|BETA)(.*) /docs/4_0_0$2
RedirectMatch Permanent ^/docs/api-(.*) /docs/$1
### Redirects to Apache Nightlies, this will change when they have a separate area for released artifacts
Redirect temp /charts https://nightlies.apache.org/solr/release/helm-charts
RedirectMatch temp ^/operator/downloads/crds(/.*) https://nightlies.apache.org/solr/release/operator/crds$1
### Javadocs & Refguide
# Hack: Append slash, if folder name does not end with slash - everything containing a "." is treated as file and excluded from redirect:
RewriteRule ^docs/\d+_\d+_\d+/(?!.+\.\w+$|.+/$).+$ $0/ [R=301,L]
RewriteRule ^guide/\d+_\d+/(?!.+\.\w+$|.+/$).+$ $0/ [R=301,L]
# __root/docs.lucene.apache.org/content/ is a special alias added by INFRA-19439, so we can refer to stuff in other places like SVN
# TODO: Move solr specific content to own root location and change these rules
RewriteRule ^docs/(\d+_\d+_\d+/.*)$ __root/docs.lucene.apache.org/content/solr/$1 [PT]
RewriteRule ^guide/\d+_\d+/.*$ __root/docs.lucene.apache.org/content/solr/$0 [PT]