Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/webroot/.htaccess
blob: 6306a01b1ed5e9e90b3e2c1a6e5d3dd6de9fb947 (plain)
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
<IfModule mod_rewrite.c>
    RewriteEngine On

    # Rewrites for services, since using .htaccess broke them.
    RewriteRule ^update/VersionCheck.php(.*)$ services/update.php$1 [L]
    RewriteRule ^plugins/PluginFinderService.php(.*)$ services/pfs.php$1 [L]
    RewriteRule ^blocklist/1/([^/]+)/([^/]+)[/]{0,1}$ services/blocklist.php?reqVersion=1&appGuid=$1&appVersion=$2 [L]
    RewriteRule ^blocklist/([23])/([^/]+)/([^/]+)/(.+)$ services/blocklist.php?reqVersion=$1&appGuid=$2&appVersion=$3&params=$4 [L]

    # robots.txt, generated by cake
    RewriteRule ^robots.txt$ en-US/firefox/pages/robots.txt [L]

    # take that, shitty https: handling!
    RewriteCond %{HTTP:Moz-Req-Method} ^HTTPS$ [NC]
    RewriteRule ^.*$ - [env=HTTPS:on,env=force-no-vary:hellsyes]
    # discussions are no more, woo!
    RewriteRule ^(.*)?discussions(/.*)?$ /$1 [R=permanent,L]
    # The old v1 urls used query strings. 
    # I can't be bothered with any of it except the id=$addon part.
    # We have to be careful to avoid matching vid=$version
    # Example old urls
    #   /extensions/moreinfo.php?application=thunderbird&id=123
    #   /extensions/moreinfo.php?id=123
    #   /themes/moreinfo.php?id=321
    #   /themes/moreinfo.php?id=321&vid=1234
    #   /themes/moreinfo.php?vid=1234&id=321
      # with ssl
      RewriteCond %{HTTP:Moz-Req-Method} ^HTTPS$ [NC]
      RewriteCond %{QUERY_STRING} (^|&)id=([0-9]+)(&|$)
      RewriteRule ^(extensions|themes)/moreinfo.php$ https://%{SERVER_NAME}/firefox/addon/%2 [R=permanent,L]
      # without ssl
      RewriteCond %{QUERY_STRING} (^|&)id=([0-9]+)(&|$)
      RewriteRule ^(extensions|themes)/moreinfo.php$ /firefox/addon/%2 [R=permanent,L]
    # Handle the trickier v2 URLs
    # /firefox/$addon
      # with ssl
      RewriteCond %{HTTP:Moz-Req-Method} ^HTTPS$ [NC]
      RewriteRule ^(firefox|thunderbird|sunbird|seamonkey)/(\d+)/?$ https://%{SERVER_NAME}/$1/addon/$2 [QSA,R=permanent,L]
      # without ssl
      RewriteRule ^(firefox|thunderbird|sunbird|seamonkey)/(\d+)/?$ /$1/addon/$2 [QSA,R=permanent,L]
    # /firefox/$user/author/
      # with ssl
      RewriteCond %{HTTP:Moz-Req-Method} ^HTTPS$ [NC]
      RewriteRule ^(firefox|thunderbird|sunbird|seamonkey)/(\d+)/author/?$ https://%{SERVER_NAME}/$1/user/$2 [QSA,R=permanent,L]
      # without ssl
      RewriteRule ^(firefox|thunderbird|sunbird|seamonkey)/(\d+)/author/?$ /$1/user/$2 [QSA,R=permanent,L]
    # legacy RSS feeds
      # with ssl
      RewriteCond %{HTTP:Moz-Req-Method} ^HTTPS$ [NC]
      RewriteRule ^rss/(firefox|thunderbird|sunbird|seamonkey)/extensions/(popular|updated|rated|newest)/?$ https://%{SERVER_NAME}/$1/browse/type:1/cat:all/sort:$2/format:rss [R=permanent,L]
      RewriteCond %{HTTP:Moz-Req-Method} ^HTTPS$ [NC]
      RewriteRule ^rss/(firefox|thunderbird|sunbird|seamonkey)/themes/(popular|updated|rated|newest)/?$ https://%{SERVER_NAME}/$1/browse/type:2/cat:all/sort:$2/format:rss [R=permanent,L]
      # without ssl
      RewriteRule ^rss/(firefox|thunderbird|sunbird|seamonkey)/extensions/(popular|updated|rated|newest)/?$ /$1/browse/type:1/cat:all/sort:$2/format:rss [R=permanent,L]
      RewriteRule ^rss/(firefox|thunderbird|sunbird|seamonkey)/themes/(popular|updated|rated|newest)/?$ /$1/browse/type:2/cat:all/sort:$2/format:rss [R=permanent,L]
    
    # do everything else cakey
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

<FilesMatch "(jquery.addons.min.js|style.min.css|\.(gif|jpe?g|png))$">   
    ExpiresActive On      
    ExpiresDefault "access plus 10 years"     
</FilesMatch>
	
# Added to fix our favicon
AddType image/x-icon ico

# HTTP only cookies for security
php_flag  session.cookie_httponly  On