From 2b0411cfd09466959f283e535ebe6ac566934779 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Fri, 14 May 2021 21:05:59 +0100 Subject: Enable permanent redirects for redirect app After monitoring traffic ingressing and confirming redirects are working as expected, I'm happy to switch redirects from the redirect app to using 301 permanent redirect. --- pydis_site/apps/redirect/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'pydis_site/apps') diff --git a/pydis_site/apps/redirect/views.py b/pydis_site/apps/redirect/views.py index 9dc9881a..21180cdf 100644 --- a/pydis_site/apps/redirect/views.py +++ b/pydis_site/apps/redirect/views.py @@ -6,9 +6,7 @@ from django.views.generic import RedirectView class CustomRedirectView(RedirectView): """Extended RedirectView for manual route args.""" - # We want temporary redirects for the time being, after this is running on prod and - # stable we can enable permanent redirects. - permanent = False + permanent = True static_args = () prefix_redirect = False -- cgit v1.2.3 From b625468a4cecbaf73b3e5228b19f449e7ff87262 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Fri, 14 May 2021 21:09:09 +0100 Subject: Update redirect tests to use 301 --- pydis_site/apps/redirect/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site/apps') diff --git a/pydis_site/apps/redirect/tests.py b/pydis_site/apps/redirect/tests.py index fce2642f..2cfa3478 100644 --- a/pydis_site/apps/redirect/tests.py +++ b/pydis_site/apps/redirect/tests.py @@ -56,6 +56,6 @@ class RedirectTests(TestCase): f"home:{data['redirect_route']}", args=expected_args ), - status_code=302 + status_code=301 ) self.assertEqual(resp.status_code, 200) -- cgit v1.2.3 From c2852bdf016c36f43b7c592345b3125bf1a1e25d Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Fri, 14 May 2021 21:11:14 +0100 Subject: Add good question guide redirect --- pydis_site/apps/redirect/redirects.yaml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pydis_site/apps') diff --git a/pydis_site/apps/redirect/redirects.yaml b/pydis_site/apps/redirect/redirects.yaml index ce789b61..c5f113fb 100644 --- a/pydis_site/apps/redirect/redirects.yaml +++ b/pydis_site/apps/redirect/redirects.yaml @@ -70,6 +70,12 @@ off-topic_redirect: redirect_route: "content:page_category" redirect_arguments: ["guides/pydis-guides/off-topic-etiquette"] +good_questions_redirect_alt: + # In a few places we were linking to a version outside of the guides app. + original_path: pages/asking-good-questions/ + redirect_route: "content:page_category" + redirect_arguments: ["guides/pydis-guides/asking-good-questions"] + # Resources resources_index_redirect: original_path: pages/resources/ -- cgit v1.2.3