Bug 1148915 - Change 302 redirects to 301s
authorEd Morley <emorley@mozilla.com>
Sun, 29 Mar 2015 20:50:44 +0400
changeset 1518 7a5a6eeaf0e0
parent 1517 44054a6338ae
child 1519 134bdfcf7e2d
push id878
push useremorley@mozilla.com
push dateTue, 31 Mar 2015 12:09:28 +0000
bugs1148915
Bug 1148915 - Change 302 redirects to 301s Now that we're confident the new 302 redirects are working as expected, and so don't need to be changed - we can change them to the more permanent 301.
.htaccess
--- a/.htaccess
+++ b/.htaccess
@@ -8,17 +8,17 @@
   RewriteBase /
 
   # Exclude the cache directory from all other rules, so we can still
   # view cache/revision_info.txt & the data-import logs.
   RewriteRule ^cache(/.*)?$ - [L]
 
   # mcMerge is now on its own hosting, so redirect separately from TBPL:
   # eg: https://tbpl.mozilla.org/mcmerge/?cset=2a404169de2d&tree=mozilla-central
-  RewriteRule ^mcmerge(/.*)?$ https://mcmerge.paas.allizom.org/ [R=302,L]
+  RewriteRule ^mcmerge(/.*)?$ https://mcmerge.paas.allizom.org/ [R=301,L]
 
   # Redirecting doesn't make sense for calls to TBPL's backend, so let's
   # return 403 Forbidden, so API consumers hit a more obvious failure mode.
   RewriteRule ^php(/.*)?$ - [F,L]
 
   # TBPL used non-standard names for the trees, so we have to convert to the
   # canonical repo name used by Treeherder/everywhere else. These rules could
   # be simplified using RewriteMap to just convert many of the repo names to
@@ -72,32 +72,32 @@
   # the one used by the UI, we don't match and so hit the catch-all, but it's not
   # worth the added complexity to handle this, since it should be rare.
   # The [NE] flag is required to prevent Apache escaping the '#' to '%23'.
 
   # Filtered by pusher:
   # eg: https://tbpl.mozilla.org/?tree=Try&pusher=email@mozilla.com
   # Any params other than the repo and pusher are discarded.
   RewriteCond %{QUERY_STRING} repo=([^&]+).*&pusher=([^&]+)
-  RewriteRule ^(.*)$ https://treeherder.mozilla.org/#/jobs?repo=%1&author=%2 [NE,R=302,L]
+  RewriteRule ^(.*)$ https://treeherder.mozilla.org/#/jobs?repo=%1&author=%2 [NE,R=301,L]
 
   # Viewing a specific revision:
   # eg: https://tbpl.mozilla.org/?tree=Try&rev=cc63db12dafb
   # Any params other than the repo and revision are discarded.
   RewriteCond %{QUERY_STRING} repo=([^&]+).*&rev=([^&]+)
-  RewriteRule ^(.*)$ https://treeherder.mozilla.org/#/jobs?repo=%1&revision=%2 [NE,R=302,L]
+  RewriteRule ^(.*)$ https://treeherder.mozilla.org/#/jobs?repo=%1&revision=%2 [NE,R=301,L]
 
   # The standard view for a repo:
   # eg: https://tbpl.mozilla.org/?tree=Mozilla-Inbound
   # Any params other than the repo are discarded.
   RewriteCond %{QUERY_STRING} repo=([^&]+)
-  RewriteRule ^(.*)$ https://treeherder.mozilla.org/#/jobs?repo=%1 [NE,R=302,L]
+  RewriteRule ^(.*)$ https://treeherder.mozilla.org/#/jobs?repo=%1 [NE,R=301,L]
 
   # For everything else just redirect with the entire query string discarded.
-  RewriteRule ^(.*)$ https://treeherder.mozilla.org/? [R=302,L]
+  RewriteRule ^(.*)$ https://treeherder.mozilla.org/? [R=301,L]
 </IfModule>
 
 <IfModule mod_expires.c>
   ExpiresActive on
   ExpiresDefault "access plus 15 minutes"
 </IfModule>
 
 # Display errors in addition to logging them