1587472e10531e350f3b628ffba4cd4bed5759e7
[stouyapi.git] / www / .htaccess
1 RewriteEngine on
2
3 #rewrite details GET parameter
4 RewriteCond %{QUERY_STRING} ^app=([^&]+)
5 RewriteCond %{DOCUMENT_ROOT}/api/v1/details-data/%1.json -f
6 RewriteRule ^api/v1/details /api/v1/details-data/%1.json? [END]
7
8 # details for unknown apps. Also see .htaccess in the dummy dir
9 RewriteRule ^api/v1/details /api/v1/details-dummy/404? [END]
10
11 RewriteRule ^api/v1/apps/(.*)/download$ /api/v1/apps/$1-download.json? [END]
12 RewriteRule ^api/v1/apps/(.*)$ /api/v1/apps/$1.json? [END]
13
14 #rewrite developer products "only" GET parameter
15 RewriteCond %{QUERY_STRING} &only=([^&]+)
16 RewriteCond %{DOCUMENT_ROOT}/api/v1/developers/$1/products/%1.json -f
17 RewriteRule ^api/v1/developers/(.+)/products/ /api/v1/developers/$1/products/%1.json? [END]
18
19 RewriteRule ^api/v1/discover/?$ /api/v1/discover-data/discover.json [END]
20 RewriteRule ^api/v1/discover/(.+)$ /api/v1/discover-data/$1.json [END]
21
22 #purchased games/products
23 # active buy requests
24 RewriteCond %{REQUEST_METHOD} POST
25 RewriteRule ^api/v1/games/(.+)/purchases?$ /api/v1/games/purchase.php [END]
26
27 RewriteCond %{REQUEST_FILENAME} !-f
28 RewriteRule ^api/v1/games/(.+)/purchases?$ /api/v1/games/purchases-empty.json [END]
29
30 #search
31 # q is first parameter
32 RewriteCond %{QUERY_STRING} ^q=([^&]+)
33 RewriteCond %{DOCUMENT_ROOT}/api/v1/search-data/%1.json -f
34 RewriteRule ^api/v1/search /api/v1/search-data/%1.json? [END]
35 # q is not the first parameter
36 RewriteCond %{QUERY_STRING} &q=([^&]+)
37 RewriteCond %{DOCUMENT_ROOT}/api/v1/search-data/%1.json -f
38 RewriteRule ^api/v1/search /api/v1/search-data/%1.json? [END]
39
40 #this one wants a 204 status code
41 RewriteRule ^api/v1/status$ - [R=204,L]