New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOLR-15557 Script to generate refguide page .htaccess redirects #596
SOLR-15557 Script to generate refguide page .htaccess redirects #596
Conversation
Moved script inside folder
I think you deleted the script in your last commit... |
Yea, moved it into the folder, but forgot to git add it :) Now it's back |
Did a bunch of 8_11 mappings, now there are only 25 pages left without a mapping. Some should point to landing pages which still does not exist in the new guide I think. |
Now tested this on a real httpd server, with a new |
Combined regex for each of the new sub paths Separate section for 8_11 redirects
Separate htaccess did not play out as intended. Going back to using top-level one. Also merged the sub-path renames into larger regex lines, and separated 8_11 guide redirects into its own section. |
if conf.htaccess: | ||
print("# Existing pages moved to sub path") | ||
for key in regex_new: | ||
print("RedirectMatch ^/guide/(%s)\.html /guide/%s/$1.html" % ("|".join(regex_new[key]), key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new Solr Ref Guide pages are going to have the structure: /guide/solr/<version>/page.html
. (This includes a /solr/
after /guide/
). And the guide will support the version tag latest
that will redirect to the latest version that has been published. Therefore these should link to /guide/solr/latest/<page>.html
(this line and the rewrite rule below it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will add the /solr/
level, and latest
version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I presume that the already existing guides will continue to live at /guide/<version>/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that presumption is correct I think.
Also, Antora is going to create another htaccess file to redirect stuff itself (including /guide/solr/latest
-> /guide/solr/9_0
). Everytime I look at htaccess, I've forgotten what I learned the previous time. Will these new rules make it so that the browser does two redirects, old-url
-> /guide/solr/latest
and then the browser issues another request: /guide/solr/latest
-> /guide/solr/9_0
? Or will htaccess do the 2 redirects itself and give the browser old-url
-> /guide/solr/9_0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This question is not a blocker, at least not for now. Easiest path forward to make this stuff work, I just wanted to better understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multi layers of .htaccess is hard to get right. The Antora folders will all reside in svn in the folder pointed to by __root/docs.solr.apache.org/guide
, so I don't even know if httpd will execute .htaccess from there. If httpd finds a .htaccess
file on a deep level, it will use that one instead of the topmost one, and if you try to inherit, then all the rules form top-level stop working.
So I think we have to put all rules in our main htaccess file, including the latest
-> 9_0
one. At the end, we'll simply have to try and see what happens.
Updated new-pages from latest build of new site from branch
Brought this up to date with latest bugfix. Should we perhaps merge it, so it can be used as basis for a future similar endeavor? |
https://issues.apache.org/jira/browse/SOLR-15557
See apache/solr-site#70 for the output of this script given the input files as of today
I added the output to this PR so it is easier to iterate in one PR and make review comments on the htaccess.txt directly. For every edit you make, please run this command before committing.
python3 gen-refguide-redirects.py --old old-guide.txt --new new-guide.txt --mapping mappings.csv --htaccess >htaccess.txt