-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtaccess-without-mindtouch
79 lines (66 loc) · 3.65 KB
/
htaccess-without-mindtouch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Note this file should be symlinked from the web root
# Example: ln -s /home/foo/mdn/configs/htaccess /var/www/dekiwiki/.htaccess
#
# Make sure AllowOverride has FileInfo
ReWriteEngine On
RewriteBase /
# Old index.php redirects
RewriteCond %{QUERY_STRING} ^title=http [NC]
RewriteRule ^index\.php$ / [L,NC]
RewriteCond %{QUERY_STRING} ^title=(.*)$ [NC]
RewriteRule ^index\.php$ %1 [R=301,L,NC]
# Links to FTP'ed code samples and examples
RewriteRule ^patches(.*) data/www/patches$1 [L]
RewriteRule ^presentations(.*) data/www/presentations$1 [L]
RewriteRule ^samples(.*) data/www/samples$1 [L]
RewriteRule ^diagrams(.*) data/www/diagrams$1 [L]
RewriteRule ^devnews(.*) data/www/devnews$1 [L]
RewriteRule ^web-tech(.*) data/www/web-tech$1 [L]
RewriteRule ^css(.*) data/www/css$1 [L]
# Disable robots on dev and stage servers
RewriteCond %{HTTP_HOST} allizom
RewriteRule ^robots.txt$ media/robots-go-away.txt [L]
# Rewrites to robots & sitemaps
RewriteRule ^robots.txt$ media/robots.txt [L]
RewriteRule ^sitemap.xml$ media/sitemap.xml [L]
RewriteRule ^sitemaps/([\w\-]*)/sitemap.xml$ media/sitemaps/$1/sitemap.xml [L]
# Bug 887428 - Misprinted URL in promo materials
RewriteRule ^Firefox_OS/Security$ docs/Mozilla/Firefox_OS/Security [R=301,L,NC]
# Old landing pages. The regex, adapted from Bedrock, captures locale prefixes.
RewriteRule ^(\w{2,3}(?:-\w{2})?/)?mobile/?$ /docs/Mozilla/Mobile [R=301,L]
RewriteRule ^(\w{2,3}(?:-\w{2})?/)?addons/?$ /Add-ons [R=301,L]
RewriteRule ^(\w{2,3}(?:-\w{2})?/)?mozilla/?$ /docs/Mozilla [R=301,L]
RewriteRule ^(\w{2,3}(?:-\w{2})?/)?web/?$ /docs/Web [R=301,L]
RewriteRule ^(\w{2,3}(?:-\w{2})?/)?learn/html5/?$ /docs/Web/Guide/HTML/HTML5 [R=301,L]
# Some blanket section moves / renames
RewriteRule ^En/JavaScript/Reference/Objects/Array$ en-US/docs/JavaScript/Reference/Global_Objects/Array [R=301,L,NC]
RewriteRule ^En/JavaScript/Reference/Objects$ en-US/docs/JavaScript/Reference/Global_Objects/Object [R=301,L,NC]
RewriteRule ^En/Core_JavaScript_1\.5_Reference/Objects/(.*) en-US/docs/JavaScript/Reference/Global_Objects/$1 [R=301,L,NC]
RewriteRule ^En/Core_JavaScript_1\.5_Reference/(.*) en-US/docs/JavaScript/Reference/$1 [R=301,L,NC]
RewriteRule ^([\w\-]*)/HTML5$ $1/docs/HTML/HTML5 [R=301,L,NC]
RewriteRule web-tech/2008/09/12/css-transforms /docs/CSS/Using_CSS_transforms [R=301,L]
RewriteRule ^([\w\-]*)/docs/?$ $1/docs/Web [R=301,L,NC]
# Off-site redirects
RewriteRule ^contests/$ http://labs.mozilla.com/contests/extendfirefox/ [R=302]
RewriteRule ^contests/extendfirefox(/.*)? http://labs.mozilla.com/contests/extendfirefox$1 [R=302]
RewriteRule ^es4(/.*)?$ http://wiki.ecmascript.org/ [R]
RewriteRule devnews/index.php/feed/atom/ https://blog.mozilla.org/feed/ [R=301,L]
# HACK: Django will eventually redirect the user to the right spot, but skip a
# couple of redirects for these known legacy locales
RewriteRule ^en/(.*)$ /mwsgi/en-US/$1 [L,QSA,NE,NC,E=CORS:True]
RewriteRule ^cn/(.*)$ /mwsgi/zh-CN/$1 [L,QSA,NE,NC,E=CORS:True]
RewriteRule ^zh_cn/(.*)$ /mwsgi/zh-CN/$1 [L,QSA,NE,NC,E=CORS:True]
RewriteRule ^zh_tw/(.*)$ /mwsgi/zh-TW/$1 [L,QSA,NE,NC,E=CORS:True]
# These are some known static files
RewriteCond %{REQUEST_URI} !/forums
RewriteCond %{REQUEST_URI} !/favicon.ico
# TODO: Should Django handle robots.txt?
RewriteCond %{REQUEST_URI} !/robots.txt
RewriteCond %{REQUEST_URI} !/block_862be.html
RewriteCond %{REQUEST_URI} !/block_f90c2.html
# Everything else passes through the Django handler
RewriteRule ^(.*)$ /mwsgi/$1 [L,QSA,NE,E=CORS:True]
# Allow wide-open CORS on the site.
Header set Access-Control-Allow-Origin "*" env=CORS
Header set Access-Control-Allow-Methods "GET" env=CORS
Header set Access-Control-Allow-Credentials "false" env=CORS