Add original version of http://ouya-updates.s3.amazonaws.com/updates-ouya_1_1.json
[stouyapi.git] / www / .htaccess
1 RewriteEngine on
2 RewriteBase /
3
4 <Files "firmware_builds">
5     ExpiresActive On
6     ExpiresDefault "access plus 1 day"
7 </Files>
8
9 #rewrite details GET parameter
10 RewriteCond %{QUERY_STRING} ^app=([^&]+)
11 RewriteCond %{DOCUMENT_ROOT}/api/v1/details-data/%1.json -f
12 RewriteRule ^api/v1/details /api/v1/details-data/%1.json? [END]
13
14 # details for unknown apps. Also see .htaccess in the dummy dir
15 RewriteRule ^api/v1/details /api/v1/details-dummy/404? [END]
16
17 RewriteRule ^api/v1/apps/(.*)/download$ /api/v1/apps/$1-download.json? [END]
18 RewriteRule ^api/v1/apps/(.*)$ /api/v1/apps/$1.json? [END]
19
20 #rewrite developer products "only" GET parameter
21 RewriteCond %{QUERY_STRING} &only=([^&]+)
22 RewriteCond %{DOCUMENT_ROOT}/api/v1/developers/$1/products/%1.json -f
23 RewriteRule ^api/v1/developers/(.+)/products/ /api/v1/developers/$1/products/%1.json? [END]
24
25 RewriteRule ^api/v1/discover/?$ /api/v1/discover-data/discover.json [END]
26 RewriteRule ^api/v1/discover/(.+)$ /api/v1/discover-data/$1.json [END]
27
28 #if directoryslash is on, gamers gets redirected to gamers/ (dir index)
29 # the ouya registration does not support redirects there
30 #TODO: Use that only for the api/v1/gamers path, not for all
31 ErrorDocument 400 /api/v1/gamers/register-error.json
32 RewriteRule ^api/v1/gamers$ /api/v1/gamers/register-error.json [R=400,END]
33
34 #prevent redirect from gamers/me to gamers/me/
35 <Files "me">
36     DirectorySlash Off
37 </Files>
38 RewriteRule ^api/v1/gamers/me$ /api/v1/gamers/me.json [END]
39
40 #purchased games/products
41 # active buy requests
42 RewriteCond %{REQUEST_METHOD} POST
43 RewriteRule ^api/v1/games/(.+)/purchases?$ /api/v1/games/purchase.php [END]
44
45 RewriteCond %{REQUEST_FILENAME} !-f
46 RewriteRule ^api/v1/games/(.+)/purchases?$ /api/v1/games/purchases-empty.json [END]
47
48 #search
49 # q is first parameter
50 RewriteCond %{QUERY_STRING} ^q=([^&]+)
51 RewriteCond %{DOCUMENT_ROOT}/api/v1/search-data/%1.json -f
52 RewriteRule ^api/v1/search /api/v1/search-data/%1.json? [END]
53 # q is not the first parameter
54 RewriteCond %{QUERY_STRING} &q=([^&]+)
55 RewriteCond %{DOCUMENT_ROOT}/api/v1/search-data/%1.json -f
56 RewriteRule ^api/v1/search /api/v1/search-data/%1.json? [END]
57
58 # for http://clients3.google.com/generate_204
59 RewriteRule ^generate_204$ /api/v1/status
60
61 #this one wants a 204 status code
62 RewriteRule ^api/v1/status$ - [R=204,L]
63
64 #push-to-my-ouya needs php scripting support
65 RewriteRule ^api/v1/queued_downloads?$ /api/v1/queued_downloads.php [END]
66
67 RewriteCond %{REQUEST_METHOD} DELETE
68 RewriteRule ^api/v1/queued_downloads/(.+)?$ /api/v1/queued_downloads_delete.php?game=$1 [END]