Skip to content

Commit d6be85c

Browse files
authored
Mark bad climate.nasa.gov redirects as 404 (#1306)
NASA went through a year-and-a-half long transition of pages from `climate.nasa.gov` to `science.nasa.gov/climate-change` that concluded a couple weeks ago. Unfortunately, when they finished, they started redirecting `climate.nasa.gov/*` to the new climate change home page instead of to the matching page on the new site, making a bunch of URLs effectively into 404s.
1 parent 1033205 commit d6be85c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/models/version.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ def effective_status # rubocop:disable Metrics/PerceivedComplexity
220220
# of climate-related pages to instead of giving them 4xx status codes.
221221
return 404 if redirected_to.ends_with?('epa.gov/sites/production/files/signpost/cc.html')
222222

223+
# Special case for climate.nasa.gov getting moved with bad redirects for all the sub-pages.
224+
return 404 if /^https?:\/\/climate.nasa.gov\/.+$/i.match?(url) &&
225+
redirected_to.ends_with?('://science.nasa.gov/climate-change/')
226+
223227
# We see a lot of redirects to the root of the same domain when a page is removed.
224228
parsed_url = Addressable::URI.parse(url)
225229
return 404 if parsed_url.path != '/' && Surt.surt(parsed_url.join('/')) == Surt.surt(redirected_to)

0 commit comments

Comments
 (0)