Nginx redirect rules to support old URLs #2

Open
opened 2024-07-28 18:42:23 +02:00 by jtbx · 1 comment
Owner

The wiki instance used query params for the pages, but the export uses the id as file name. So a mapping from do GET param to file name is needed like this:

  • /doku.php?id=self-organized-sessions -> /self-organized-sessions.html
  • doku.php?id=wiki:dokuwiki -> /wiki/dokuwiki.html

But actually all relevant pages are on the root level. Only intern (not exported), playground (removed as irrelevant), wiki syntax (removed as irrelevant) and ticket-exchanged (removed due to personal data) were in their own namespace.

The wiki instance used query params for the pages, but the export uses the id as file name. So a mapping from `do` GET param to file name is needed like this: - /doku.php?id=self-organized-sessions -> /self-organized-sessions.html - doku.php?id=wiki:dokuwiki -> /wiki/dokuwiki.html But actually all relevant pages are on the root level. Only intern (not exported), playground (removed as irrelevant), wiki syntax (removed as irrelevant) and ticket-exchanged (removed due to personal data) were in their own namespace.
Author
Owner

Do something like this:

    location / {
        ssi on;
        root   /usr/share/nginx/html;
        index  start.html;
    }

    # redirect doku.php?id=$pagename to /$pagename.html
    location /doku.php {
        return 301 $scheme://$host:$server_port/$arg_id.html;
    }
Do something like this: ``` location / { ssi on; root /usr/share/nginx/html; index start.html; } # redirect doku.php?id=$pagename to /$pagename.html location /doku.php { return 301 $scheme://$host:$server_port/$arg_id.html; } ```
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: CCCHH/easterhegg-eh20-website#2
No description provided.