dbca-wa / science-projects-client

The frontend for SPMS, a science project management and documentation system.
0 stars 0 forks source link

Generate an NGINX map file to use during the production migration for bulk redirecting old profile URLs to the new ones #464

Closed ben3000 closed 1 month ago

ben3000 commented 2 months ago

Articles such as https://gauravswaroop.medium.com/nginx-bulk-url-redirect-with-map-47c2cd6ad50a describe a relatively simple way to specify a lot of URLs to be redirected from an old URL to a new one. Use this feature to ensure web links to our staff profiles aren't broken during the transition to SPMS profiles.

Example:

map $request_uri $new_uri {
    default "";
    https://science.dbca.wa.gov.au/people/?sid=98 https://science-profiles.dbca.wa.gov.au/staff/390;
    https://science.dbca.wa.gov.au/people/?sid=95 https://science-profiles.dbca.wa.gov.au/staff/109;
    ...
}

These are permanent (301) redirects. The server block has to have additional configuration too:

server {
    listen 80;
    server_name example.com;

    if ($redirect_url) {
        return 301 $redirect_url;
    }
    ...
}
idabblewith commented 2 months ago

NGINX Map and CSV file for user ids have been passed over.

ben3000 commented 2 months ago

The CSV is now used by the temporary Scinet Redirector, see ben3000/science-internet-webapp#5.