Cheshire Yang (@cyang) on GitLab, 2018-04-01.
In this version I notice I'm processing files inconsistent from how our Ruby version did it:
Here, a file content/pagename.html is rendered as output/pagename.html, whereas the Ruby program converted content/pagename.html to output/pagename/index.html with the sole exception of the site's home page.
It's necessary to do it the old way, to prevent 404s on other sites that link to CLnet. For instance, common-lisp.net/about would become a 404 as the page would have moved to common-lisp.net/about.html
I'm not sure if there is an elegant way to solve this because the home page index.html is an edge case. Is there an elegant and easy way to exclude content/index.html when creating a list of files within content/? Just call filter with an if expression? I just have a gut instinct against a single exception but maybe it's unavoidable?
Administrator (@root) on GitLab, 2018-10-06.
The way to preserve the original paths is by introducing rewrite maps.
However, is there a good reason to change the paths at all?
@mmontone can we address this issue before going live with the current version of the site? Or doesnn't it have this issue?
Mariano Montone (@mmontone) on GitLab, 2018-10-06.
I don't know if this is still an issue. The site is hosted on Apache using Multiviews. I don't know much about them, but both the url with .html and without it work.
See: https://new.common-lisp.net/about.html https://new.common-lisp.net/about
Does that solve this issue?
Mariano Montone (@mmontone) on GitLab, 2018-10-06.
I think there's a problem with urls eding with '/'. For example, https://new.common-lisp.net/about/ doesn't work. But we could write an apache rule that strips the '/' for that.
Administrator (@root) on GitLab, 2018-10-06.
I think that's the solution indeed: have an apache rule to redirect to /about if there's no directory called /about/. I can implement this today and we can close this issue as far as I'm concerned.
Mariano Montone (@mmontone) on GitLab, 2018-10-06.
I think this apache rule is correct for that:
RewriteEngine on
# Check the url does not point to a directory
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-d
# Strip the slash at the end
RewriteRule "^(.+?)\/$" "$1"
Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-06.
Just installed the rewrite rule, but it doesn't seem to work.
(Note that I installed some of my own variants of it too, but those didn't seem to work either.)
Mariano Montone (@mmontone) on GitLab, 2018-10-06.
Mmm...strange... it works for me (locally)
Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-06.
Actually, it works indeed. However, not in the context I was executing it in:
You're running the redirect in the context of the virtual host. I was running it in the directory I want it to apply to, which is: the document root, but not the directories in which the projects are situated (mapped into the URL space at /project/*)
Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-09.
Instead of doing anything complex, I solved this problem by setting up a fixed set of rewrite rules:
RewriteRule "^/about/$" "/about" [R=301]
RewriteRule "^/contribute/$" "/contribute" [R=301]
RewriteRule "^/downloads/$" "/downloads" [R=301]
RewriteRule "^/faq/$" "/faq" [R=301]
RewriteRule "^/gitlab-migration-repository-mapping/$" "/gitlab-migration-repository-mapping" [R=301]
RewriteRule "^/gitlab-migration-status/$" "/gitlab-migration-status" [R=301]
RewriteRule "^/independent-lists/$" "/independent-lists" [R=301]
RewriteRule "^/news/$" "/news" [R=301]
RewriteRule "^/orphaned-mailing-lists/$" "/orphaned-mailing-lists" [R=301]
RewriteRule "^/orphaned-projects/$" "/orphaned-projects" [R=301]
RewriteRule "^/phub/$" "/phub" [R=301]
RewriteRule "^/project-intro/$" "/project-intro" [R=301]
RewriteRule "^/projects/$" "/phub" [R=301]
RewriteRule "^/tools/$" "/tools" [R=301]
RewriteRule "^/tutorial/$" "/tutorial" [R=301]
RewriteRule "^/tutorials/$" "/tutorials" [R=301]
Sign in to comment.