diff --git a/bedrock/press/redirects.py b/bedrock/press/redirects.py index 9719b5d47f9..4a20feaec67 100644 --- a/bedrock/press/redirects.py +++ b/bedrock/press/redirects.py @@ -179,4 +179,117 @@ redirect(r'^press/open-source-security\.html$', 'http://blog.mozilla.org/press/2000/01/open-source-development-of-security-products-' 'possible-worldwide-enhancing-security-and-privacy-for-e-commerce-and-communication/'), + + # Bug 774331 - European press pages + # en-GB + redirect(r'^en-GB/press/?$', 'https://blog.mozilla.org/press-uk/', locale_prefix=False), + redirect(r'^en-GB/press/media/?$', 'https://blog.mozilla.org/press-uk/media-library/', + locale_prefix=False), + redirect(r'^en-GB/press/media/logos/?$', 'https://blog.mozilla.org/press-uk/media-library/', + locale_prefix=False), + redirect(r'^en-GB/press/media/screenshots/?$', + 'https://blog.mozilla.org/press-uk/media-library/product-screenshots/', + locale_prefix=False), + redirect(r'^en-GB/press/media/images/?$', 'https://blog.mozilla.org/press-uk/media-library/', + locale_prefix=False), + redirect(r'^en-GB/press/media/videos/?$', + 'https://blog.mozilla.org/press-uk/media-library/videos/', locale_prefix=False), + + # de + redirect(r'^de/press/?$', 'https://blog.mozilla.org/press-de/', locale_prefix=False), + redirect(r'^de/press/media/?$', 'https://blog.mozilla.org/press-de/medienbibliothek/', + locale_prefix=False), + redirect(r'^de/press/media/logos/?$', 'https://blog.mozilla.org/press-de/medienbibliothek/', + locale_prefix=False), + redirect(r'^de/press/media/screenshots/?$', + 'https://blog.mozilla.org/press-de/medienbibliothek/produkt-screenshots/', + locale_prefix=False), + redirect(r'^de/press/media/images/?$', 'https://blog.mozilla.org/press-de/medienbibliothek/', + locale_prefix=False), + redirect(r'^de/press/media/videos/?$', + 'https://blog.mozilla.org/press-de/medienbibliothek/videos/', locale_prefix=False), + redirect(r'^de/press/media/bios/?$', 'https://blog.mozilla.org/press/media-library/bios/', + locale_prefix=False), + + # fr + redirect(r'^fr/press/?$', 'https://blog.mozilla.org/press-fr/', locale_prefix=False), + redirect(r'^fr/press/media/?$', 'https://blog.mozilla.org/press-fr/bibliotheque-mozilla/', + locale_prefix=False), + redirect(r'^fr/press/media/logos/?$', 'https://blog.mozilla.org/press-fr/bibliotheque-mozilla/', + locale_prefix=False), + redirect(r'^fr/press/media/screenshots/?$', + 'https://blog.mozilla.org/press-fr/bibliotheque-mozilla/captures-decran-produits/', + locale_prefix=False), + redirect(r'^fr/press/media/images/?$', + 'https://blog.mozilla.org/press-fr/bibliotheque-mozilla/', locale_prefix=False), + redirect(r'^fr/press/media/videos/?$', + 'https://blog.mozilla.org/press-fr/bibliotheque-mozilla/videos/', locale_prefix=False), + redirect(r'^fr/press/media/bios/?$', 'https://blog.mozilla.org/press/media-library/bios/', + locale_prefix=False), + + # it + redirect(r'^it/press/?$', 'https://blog.mozilla.org/press-it/', locale_prefix=False), + redirect(r'^it/press/media/?$', 'https://blog.mozilla.org/press-it/galleria-multimediale/', + locale_prefix=False), + redirect(r'^it/press/media/logos/?$', + 'https://blog.mozilla.org/press-it/galleria-multimediale/', locale_prefix=False), + redirect(r'^it/press/media/screenshots/?$', + 'https://blog.mozilla.org/press-it/galleria-multimediale/immagini-del-prodotto/', + locale_prefix=False), + redirect(r'^it/press/media/images/?$', + 'https://blog.mozilla.org/press-it/galleria-multimediale/', locale_prefix=False), + redirect(r'^it/press/media/videos/?$', + 'https://blog.mozilla.org/press-it/galleria-multimediale/videos/', + locale_prefix=False), + redirect(r'^it/press/media/bios/?$', 'https://blog.mozilla.org/press/media-library/bios/', + locale_prefix=False), + + # es + redirect(r'^es(-[A-Z]{2})?/press/?$', 'https://blog.mozilla.org/press-es/', locale_prefix=False), + redirect(r'^es(-[A-Z]{2})?/press/media/?$', + 'https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/', + locale_prefix=False), + redirect(r'^es(-[A-Z]{2})?/press/media/logos/?$', + 'https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/', + locale_prefix=False), + redirect(r'^es(-[A-Z]{2})?/press/media/screenshots/?$', + 'https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/imagenes-del-producto/', + locale_prefix=False), + redirect(r'^es(-[A-Z]{2})?/press/media/images/?$', + 'https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/', + locale_prefix=False), + redirect(r'^es(-[A-Z]{2})?/press/media/videos/?$', + 'https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/videos/', + locale_prefix=False), + redirect(r'^es(-[A-Z]{2})?/press/media/bios/?$', 'https://blog.mozilla.org/press/media-library/bios/', + locale_prefix=False), + + # pl + redirect(r'^pl/press/?$', 'https://blog.mozilla.org/press-pl/', locale_prefix=False), + redirect(r'^pl/press/media/?$', 'https://blog.mozilla.org/press-pl/galeria-multimediow/', + locale_prefix=False), + redirect(r'^pl/press/media/logos/?$', 'https://blog.mozilla.org/press-pl/galeria-multimediow/', + locale_prefix=False), + redirect(r'^pl/press/media/screenshots/?$', + 'https://blog.mozilla.org/press-pl/galeria-multimediow/screenshoty-produktow/', + locale_prefix=False), + redirect(r'^pl/press/media/images/?$', 'https://blog.mozilla.org/press-pl/galeria-multimediow/', + locale_prefix=False), + redirect(r'^pl/press/media/videos/?$', + 'https://blog.mozilla.org/press-pl/galeria-multimediow/videos/', locale_prefix=False), + redirect(r'^pl/press/media/bios/?$', 'https://blog.mozilla.org/press/media-library/bios/', + locale_prefix=False), + + # rest + # Bug 747565 + redirect(r'^press/?$', 'https://blog.mozilla.org/press/'), + redirect(r'^press/ataglance/?$', 'https://blog.mozilla.org/press/ataglance/'), + redirect(r'^press/bios/?$', 'https://blog.mozilla.org/press/bios/'), + redirect(r'^press/kits/?$', 'https://blog.mozilla.org/press/kits/'), + redirect(r'^press/media/?$', 'https://blog.mozilla.org/press/media-library/'), + redirect(r'^press/media/logos/?$', 'https://blog.mozilla.org/press/media-library/'), + redirect(r'^press/media/bios/?$', 'https://blog.mozilla.org/press/media-library/bios/'), + redirect(r'^press/media/screenshots/?$', + 'https://blog.mozilla.org/press/media-library/screenshots/'), + redirect(r'^press/media/videos/?$', 'https://blog.mozilla.org/press/media-library/videos/'), ) diff --git a/etc/httpd/global.conf b/etc/httpd/global.conf index 9bb3f54f481..aa881ffb37e 100644 --- a/etc/httpd/global.conf +++ b/etc/httpd/global.conf @@ -288,7 +288,7 @@ RewriteRule ^/en-US/firefox/channel/android(/?)$ /b/en-US/firefox/channel/androi # bug 1059518 RewriteRule ^/(\w{2,3}(?:-\w{2})?/)?firefox/tiles(.*)$ /b/$1firefox/tiles$2 [PT] -# bug 1196569 +# bug 1196569 RewriteRule ^/(\w{2,3}(?:-\w{2})?/)?firefox/private-browsing(/?)$ /b/$1firefox/private-browsing$2 [PT] # bug 784737 @@ -726,3 +726,5 @@ RewriteRule ^(/(?:\w{2,3}(?:-\w{2})?/)?firefox/all-older\.html)$ /b$1 [PT] # bug 1188572 RewriteRule ^/(\w{2,3}(?:-\w{2})?/)?teach(/?|/.+)$ /b/$1teach$2 [PT] + +RewriteRule ^(/(?:\w{2,3}(?:-\w{2})?/)?press(/.*)?)$ /b$1 [PT] diff --git a/test_redirects/map_htaccess.py b/test_redirects/map_htaccess.py new file mode 100644 index 00000000000..522d1c2a1b4 --- /dev/null +++ b/test_redirects/map_htaccess.py @@ -0,0 +1,92 @@ +from __future__ import absolute_import + +from .base import flatten, url_test + + +URLS = flatten(( + # Bug 774331 - European press pages + # en-GB + url_test('/en-GB/press/', 'https://blog.mozilla.org/press-uk/'), + url_test('/en-GB/press/media/', 'https://blog.mozilla.org/press-uk/media-library/'), + url_test('/en-GB/press/media/logos/', 'https://blog.mozilla.org/press-uk/media-library/'), + url_test('/en-GB/press/media/screenshots/', + 'https://blog.mozilla.org/press-uk/media-library/product-screenshots/'), + url_test('/en-GB/press/media/images/', 'https://blog.mozilla.org/press-uk/media-library/'), + url_test('/en-GB/press/media/videos/', + 'https://blog.mozilla.org/press-uk/media-library/videos/'), + + # de + url_test('/de/press/', 'https://blog.mozilla.org/press-de/'), + url_test('/de/press/media/', 'https://blog.mozilla.org/press-de/medienbibliothek/'), + url_test('/de/press/media/logos/', 'https://blog.mozilla.org/press-de/medienbibliothek/'), + url_test('/de/press/media/screenshots/', + 'https://blog.mozilla.org/press-de/medienbibliothek/produkt-screenshots/'), + url_test('/de/press/media/images/', 'https://blog.mozilla.org/press-de/medienbibliothek/'), + url_test('/de/press/media/videos/', + 'https://blog.mozilla.org/press-de/medienbibliothek/videos/'), + url_test('/de/press/media/bios/', 'https://blog.mozilla.org/press/media-library/bios/'), + + # fr + url_test('/fr/press/', 'https://blog.mozilla.org/press-fr/'), + url_test('/fr/press/media/', 'https://blog.mozilla.org/press-fr/bibliotheque-mozilla/'), + url_test('/fr/press/media/logos/', 'https://blog.mozilla.org/press-fr/bibliotheque-mozilla/'), + url_test('/fr/press/media/screenshots/', + 'https://blog.mozilla.org/press-fr/bibliotheque-mozilla/captures-decran-produits/'), + url_test('/fr/press/media/images/', + 'https://blog.mozilla.org/press-fr/bibliotheque-mozilla/'), + url_test('/fr/press/media/videos/', + 'https://blog.mozilla.org/press-fr/bibliotheque-mozilla/videos/'), + url_test('/fr/press/media/bios/', 'https://blog.mozilla.org/press/media-library/bios/'), + + # it + url_test('/it/press/', 'https://blog.mozilla.org/press-it/'), + url_test('/it/press/media/', 'https://blog.mozilla.org/press-it/galleria-multimediale/'), + url_test('/it/press/media/logos/', + 'https://blog.mozilla.org/press-it/galleria-multimediale/'), + url_test('/it/press/media/screenshots/', + 'https://blog.mozilla.org/press-it/galleria-multimediale/immagini-del-prodotto/'), + url_test('/it/press/media/images/', + 'https://blog.mozilla.org/press-it/galleria-multimediale/'), + url_test('/it/press/media/videos/', + 'https://blog.mozilla.org/press-it/galleria-multimediale/videos/'), + url_test('/it/press/media/bios/', 'https://blog.mozilla.org/press/media-library/bios/'), + + # es + url_test('/es{,-ES,-AR,-MX}/press/', 'https://blog.mozilla.org/press-es/'), + url_test('/es{,-ES,-AR,-MX}/press/media/', + 'https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/'), + url_test('/es{,-ES,-AR,-MX}/press/media/logos/', + 'https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/'), + url_test('/es{,-ES,-AR,-MX}/press/media/screenshots/', + 'https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/imagenes-del-producto/'), + url_test('/es{,-ES,-AR,-MX}/press/media/images/', + 'https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/'), + url_test('/es{,-ES,-AR,-MX}/press/media/videos/', + 'https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/videos/'), + url_test('/es{,-ES,-AR,-MX}/press/media/bios/', 'https://blog.mozilla.org/press/media-library/bios/'), + + # pl + url_test('/pl/press/', 'https://blog.mozilla.org/press-pl/'), + url_test('/pl/press/media/', 'https://blog.mozilla.org/press-pl/galeria-multimediow/'), + url_test('/pl/press/media/logos/', 'https://blog.mozilla.org/press-pl/galeria-multimediow/'), + url_test('/pl/press/media/screenshots/', + 'https://blog.mozilla.org/press-pl/galeria-multimediow/screenshoty-produktow/'), + url_test('/pl/press/media/images/', 'https://blog.mozilla.org/press-pl/galeria-multimediow/'), + url_test('/pl/press/media/videos/', + 'https://blog.mozilla.org/press-pl/galeria-multimediow/videos/'), + url_test('/pl/press/media/bios/', 'https://blog.mozilla.org/press/media-library/bios/'), + + # rest + # Bug 747565 + url_test('/press/', 'https://blog.mozilla.org/press/'), + url_test('/press/ataglance/', 'https://blog.mozilla.org/press/ataglance/'), + url_test('/press/bios/', 'https://blog.mozilla.org/press/bios/'), + url_test('/press/kits/', 'https://blog.mozilla.org/press/kits/'), + url_test('/press/media/', 'https://blog.mozilla.org/press/media-library/'), + url_test('/press/media/logos/', 'https://blog.mozilla.org/press/media-library/'), + url_test('/press/media/bios/', 'https://blog.mozilla.org/press/media-library/bios/'), + url_test('/press/media/screenshots/', + 'https://blog.mozilla.org/press/media-library/screenshots/'), + url_test('/press/media/videos/', 'https://blog.mozilla.org/press/media-library/videos/'), + +)) diff --git a/test_redirects/test_urls.py b/test_redirects/test_urls.py index 2c1b893bd57..5beb460b139 100644 --- a/test_redirects/test_urls.py +++ b/test_redirects/test_urls.py @@ -5,8 +5,9 @@ import pytest from .base import assert_valid_url -from .map_globalconf import URLS as GLOBAL_URLS from .map_410 import URLS_410 +from .map_htaccess import URLS as HTA_URLS +from .map_globalconf import URLS as GLOBAL_URLS @pytest.mark.parametrize('url', GLOBAL_URLS, ids=itemgetter('url')) @@ -16,6 +17,13 @@ def test_global_conf_url(url, live_or_remote_server): assert_valid_url(**url) +@pytest.mark.parametrize('url', HTA_URLS, ids=itemgetter('url')) +def test_htaccess_url(url, live_or_remote_server): + # live_or_remote_server defined in conftest.py + url['base_url'] = live_or_remote_server + assert_valid_url(**url) + + @pytest.mark.parametrize('url', URLS_410) def test_410_url(url, live_or_remote_server): assert_valid_url(url, status_code=410, base_url=live_or_remote_server)