Skip to content

Instantly share code, notes, and snippets.

@janhoy
Created March 4, 2021 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janhoy/a3149e1ed27df020194a2de1a7fa2c16 to your computer and use it in GitHub Desktop.
Save janhoy/a3149e1ed27df020194a2de1a7fa2c16 to your computer and use it in GitHub Desktop.
solr_redirects.conf
#### https://issues.apache.org/jira/browse/SOLR-10595
# ############# NOTE TO INFRA ##################
#
# The RewriteCond/RewriteRules below were tested in a mocked up system where
# they were placed in an .htaccess, and the following RewriteMap directives existed
# for the VirtualHost being used...
#
RewriteMap solr_id_to_new "txt:/home/hossman/tmp/solr_id_to_new.map.txt"
RewriteMap solr_name_to_new "txt:/home/hossman/tmp/solr_name_to_new.map.txt"
#
# Maps with these names (using the provided files) will need to be declared in the appropriate
# VirtualHost or Server context using whatever "real" path you choose.
#
# The specific regexes used in the RewriteRule declarations may need to be tweaked depending
# on where/how exactly you want to implement these redirects (ie: on the cwiki.apache.org proxy httpd,
# or on the origin httpd?) and the effective RewriteBase.
#
# ############# NOTE TO INFRA ##################
# https://issues.apache.org/jira/browse/SOLR-10595
# Redirect Solr Ref Guide pages to new home on lucene.apache.org
#
# 1) Redirect any /solr/Foo pages to the new (mapped) page name on lucene.apache.org
# Example...
# https://cwiki.apache.org/confluence/display/solr/Apache+Solr+Reference+Guide
# https://cwiki.apache.org/confluence/display/solr/Getting+Started
# https://cwiki.apache.org/confluence/display/solr/Plugins+%26+Stats+Screen
# NOTE: Mapping already includes the leading slash
RewriteCond "${solr_name_to_new:$1}" !="" [NC]
RewriteRule "solr/(.*)" https://lucene.apache.org/solr/guide/6_6${solr_name_to_new:$1}? [R=301,NC,NE]
#
# Pick up any 'action' on a known Solr pageId and redirect them as well
# This deals with things like the edit/history urls...
# https://cwiki.apache.org/confluence/pages/editpage.action?pageId=32604168 (Getting Started)
# https://cwiki.apache.org/confluence/pages/viewpreviousversions.action?pageId=32604168 (Getting Started)
# ...as well as the default "view" urls for pages that had non-trivial punctuation in them...
# https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=32604180 (Plugins & Stats Screen)
# NOTE: Mapping already includes the leading slash
RewriteCond %{QUERY_STRING} pageId=(\d+)
RewriteCond "${solr_id_to_new:%1}" !="" [NC]
RewriteRule ".*" https://lucene.apache.org/solr/guide/6_6${solr_id_to_new:%1}? [R=301,NC,NE]
#
# If we still have a "/solr(/?).*" URL, redirect it to the new top level guide page
# This is better then leaving them on the old site, and will also short circut the 302 redirect
# that confluence will do for "/" -> /Apache+Solr+Reference+Guide
# https://cwiki.apache.org/confluence/display/solr
# https://cwiki.apache.org/confluence/display/solr/
RewriteRule "^solr(/?)" https://lucene.apache.org/solr/guide/ [R=301,NC,NE]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment