Skip to content

Commit

Permalink
Consolidate redirects (#379)
Browse files Browse the repository at this point in the history
* Move rename 301s to redirects file

* Use renamed redirect file
  • Loading branch information
zwolf authored Sep 23, 2024
1 parent 664e9d3 commit a286272
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ADD nginx.conf /etc/nginx/nginx.conf
ADD nginx-redirects.conf /etc/nginx/redirects.conf
ADD nginx-proxy.conf /etc/nginx/proxy.conf
ADD nginx-proxy-security-headers.conf /etc/nginx/proxy-security-headers.conf
ADD nginx-fem-project-redirects.conf /etc/nginx/fem-project-redirects.conf
ADD nginx-project-redirects.conf /etc/nginx/project-redirects.conf
ADD nginx-pfe-redirects.conf /etc/nginx/pfe-redirects.conf
ADD nginx-pfe-staging-redirects.conf /etc/nginx/pfe-staging-redirects.conf
ADD nginx-s3-proxy-headers.conf /etc/nginx/s3-proxy-headers.conf
Expand Down
36 changes: 36 additions & 0 deletions nginx-fem-project-redirects.conf → nginx-project-redirects.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
# Redirects for renamed projects

location ~* ^/projects/meredithspalmer/(cedar-creek-eyes-on-the-wild/?)(.*?)\/?$ {
return 301 /projects/forestis/$1$2$is_args$query_string;
}

location ~* ^/projects/karilint/the-cradle-of-mankind(/?)(.*?)\/?$ {
return 301 /projects/karilint/cradle-of-humanity$1$2$is_args$query_string;
}

location ~* ^/projects/cseidenstuecker/every-name-counts(/?)(.*?)\/?$ {
return 301 /projects/arolsen-archives/every-name-counts$1$2$is_args$query_string;
}

location ~* ^/projects/kevinesolberg/mapping-prejudice(/?)(.*?)\/?$ {
return 301 /projects/mappingprejudice/mapping-prejudice$1$2$is_args$query_string;
}

location ~* ^/projects/chiarasemenzin/maturity-of-baby-sounds(/?)(.*?)\/?$ {
return 301 /projects/laac-lscp/maturity-of-baby-sounds$1$2$is_args$query_string;
}

location ~* ^/projects/sarah-middle/voyages-in-time(/?)(.*?)\/?$ {
return 301 /projects/toolsofknowledge/voyages-in-time$1$2$is_args$query_string;
}

location ~* ^/projects/rsengar/pulsar-seekers(/?)(.*?)\/?$ {
return 301 /projects/rsengar/einstein-at-home-pulsar-seekers$1$2$is_args$query_string;
}

location ~* ^/projects/hughdickinson/superwasp-black-hole-hunters(/?)(.*?)\/?$ {
return 301 /projects/cobalt-lensing/black-hole-hunters$1$2$is_args$query_string;
}

# FEM project redirects

location ~* ^/projects/(?:[\w-]*?/)?zookeeper/galaxy-zoo-weird-and-wonderful/?(?:(classify|about)(?:/.+?)?)?/?$ {
resolver 1.1.1.1;
proxy_pass $fe_project_uri;
Expand Down
2 changes: 1 addition & 1 deletion sites/frontend.preview.zooniverse.org.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {
set $fe_project_host "fe-project.preview.zooniverse.org";

include /etc/nginx/ssl.default.conf;
include /etc/nginx/fem-project-redirects.conf;
include /etc/nginx/project-redirects.conf;
include /etc/nginx/pfe-staging-redirects.conf;
server_name frontend.preview.zooniverse.org;

Expand Down
2 changes: 1 addition & 1 deletion sites/static-staging.zooniverse.org.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {
set $fe_project_host "fe-project.preview.zooniverse.org";

include /etc/nginx/ssl.default.conf;
include /etc/nginx/fem-project-redirects.conf;
include /etc/nginx/project-redirects.conf;
include /etc/nginx/pfe-staging-redirects.conf;
server_name static-staging.zooniverse.org;

Expand Down
34 changes: 1 addition & 33 deletions sites/www.zooniverse.org.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {
set $fe_project_host "fe-project.zooniverse.org";

include /etc/nginx/ssl.default.conf;
include /etc/nginx/fem-project-redirects.conf;
include /etc/nginx/project-redirects.conf;
include /etc/nginx/pfe-redirects.conf;

server_name www.zooniverse.org;
Expand Down Expand Up @@ -76,38 +76,6 @@ server {
return 301 /about/contact;
}

location ~* ^/projects/meredithspalmer/(cedar-creek-eyes-on-the-wild/?)(.*?)\/?$ {
return 301 /projects/forestis/$1$2$is_args$query_string;
}

location ~* ^/projects/karilint/the-cradle-of-mankind(/?)(.*?)\/?$ {
return 301 /projects/karilint/cradle-of-humanity$1$2$is_args$query_string;
}

location ~* ^/projects/cseidenstuecker/every-name-counts(/?)(.*?)\/?$ {
return 301 /projects/arolsen-archives/every-name-counts$1$2$is_args$query_string;
}

location ~* ^/projects/kevinesolberg/mapping-prejudice(/?)(.*?)\/?$ {
return 301 /projects/mappingprejudice/mapping-prejudice$1$2$is_args$query_string;
}

location ~* ^/projects/chiarasemenzin/maturity-of-baby-sounds(/?)(.*?)\/?$ {
return 301 /projects/laac-lscp/maturity-of-baby-sounds$1$2$is_args$query_string;
}

location ~* ^/projects/sarah-middle/voyages-in-time(/?)(.*?)\/?$ {
return 301 /projects/toolsofknowledge/voyages-in-time$1$2$is_args$query_string;
}

location ~* ^/projects/rsengar/pulsar-seekers(/?)(.*?)\/?$ {
return 301 /projects/rsengar/einstein-at-home-pulsar-seekers$1$2$is_args$query_string;
}

location ~* ^/projects/hughdickinson/superwasp-black-hole-hunters(/?)(.*?)\/?$ {
return 301 /projects/cobalt-lensing/black-hole-hunters$1$2$is_args$query_string;
}

# Default to fe-root app
location / {
resolver 1.1.1.1;
Expand Down

0 comments on commit a286272

Please sign in to comment.