[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#877367: www.debian.org: Please consider adding redirects for old Policy chapters/appendices

Control: tags -1 +patch

Meanwhile we resolve #877337 (trying to accomodate in the website both
single-page HTML and splitted in chapters HTML versions of
debian-policy), I've prepared a patch so the petitions to the old
addresses (splitted in chapters format) are redirected to the
corresponding sections in the single-html file.

The patch is for the Apache configuration of www.debian.org, in
particular, the file:


I've checked that the names of the old chapters match with the name of
the current sections.

I've tried to take into account that both URLs of the type
www.debian.org/doc/debian-policy/ch-whatever.html and
www.debian.org/doc/debian-policy/ch-whatever.html#oldsection are
redirected to www.debian.org/doc/debian-policy/#document-ch-whatever
(not sure if I did it correctly, though).

I didn't add exact rules to match
www.debian.org/doc/debian-policy/footnotes.html#f1 to
www.debian.org/doc/debian-policy/#id1 etc because I'm not sure all the
"old" footnotes and the "new" footnotes match in content; I've just
tried to redirect to the manual page for that cases.

My regex skills are few so I've just tried to produce something looking
at the already existing RewriteRule expressions. Please review and
improve if possible.

In 2-3 days, I'll file an RT ticket with this patch (or improvements)
for DSA. If you happen to review it and improve it and want to file the
ticket yourselves, please go ahead!

Laura Arjona Reina
>From dfe1ccb56d4d179970464e27ee2564deea935f92 Mon Sep 17 00:00:00 2001
From: Laura Arjona Reina <larjona@debian.org>
Date: Fri, 1 Dec 2017 23:23:45 +0100
Subject: [PATCH] Add redirections for the debian-policy pages (now we use a
 single html file)

 modules/roles/templates/apache-www.debian.org.erb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/roles/templates/apache-www.debian.org.erb b/modules/roles/templates/apache-www.debian.org.erb
index b26d8837..f67b487f 100644
--- a/modules/roles/templates/apache-www.debian.org.erb
+++ b/modules/roles/templates/apache-www.debian.org.erb
@@ -216,7 +216,7 @@
    RewriteRule ^/ports/freebsd(.*) /ports/kfreebsd-gnu/ [R=301]
    RewriteRule ^/devel/debian-installer/report-template(.*) /releases/stable/i386/ch05s04.html#submit-bug [NE,R=301]
    RewriteRule ^/devel/debian-installer/hooks(.*) http://d-i.alioth.debian.org/doc/internals/apb.html [R=301]
-   RewriteRule ^/doc/packaging-manuals/mime-policy(.*) /doc/debian-policy/ch-opersys.html#s-mime [NE,R=301]
+   RewriteRule ^/doc/packaging-manuals/mime-policy(.*) /doc/debian-policy/#multimedia-handlers [NE,R=301]
    RewriteRule ^/volatile/index.* - [S=1]
    RewriteRule ^/volatile/.+ /volatile/ [L,R=301]
@@ -243,6 +243,12 @@
 # New Maintainers' Guide
    RewriteRule ^/doc/(manuals/)?maint-guide/ch-(.*) /doc/manuals/maint-guide/$2 [R=301]
    RewriteRule ^/doc/(manuals/)?maint-guide/footnotes(.*) /doc/manuals/maint-guide/index$2 [R=301]
+# Debian Policy
+   RewriteRule ^/doc/debian-policy/ap-([^/]+).html(.*) /doc/debian-policy/#document-ap-$1 [NE,R=301]
+   RewriteRule ^/doc/debian-policy/ch-([^/]+).html(.*) /doc/debian-policy/#document-ch-$1 [NE,R=301]
+   RewriteRule ^/doc/debian-policy/upgrading-checklist.html(.*) /doc/debian-policy/#upgrading-checklist [NE,R=301]
+   RewriteRule ^/doc/debian-policy/footnotes.html(.*) /doc/debian-policy/ [R=301,L]
 # Canonical place for manuals under /doc/manuals/
    RewriteCond %{DOCUMENT_ROOT}/doc/manuals/$1 -d

Reply to: