forked from SpaceApi-archive/OpenSpaceLint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
99 lines (83 loc) · 4.17 KB
/
.htaccess
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
AddType application/json .json
Options -Indexes
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^c/js/apienv.js$ /c/php/controller.php?delegator=apienv&action=get [L]
RewriteRule ^config.js$ /c/php/controller.php?delegator=jsconfig&action=get [L]
RewriteRule ^status/(.*)$ /c/php/controller.php?delegator=status&action=get&resource=$1 [L]
RewriteRule ^cache/update/(.*)$ /c/php/controller.php?delegator=cache&action=update&resource=$1 [L]
RewriteRule ^cache/(.*)$ /c/php/controller.php?delegator=cache&action=get&resource=$1 [L]
RewriteRule ^specs/0.(.*)$ /c/php/controller.php?delegator=specs&action=get&resource=$1 [L]
RewriteRule ^specs/changelog$ /c/specs/changelog [L]
# validate a cached space api file from a given space name or raw json data
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^validate/(.*)$ /c/php/controller.php?delegator=validator&action=get&resource=$1 [L]
# validate a space api implementation from a URL (the trailing slash is optional)
RewriteCond %{QUERY_STRING} ^url [OR]
RewriteCond %{QUERY_STRING} ^json
RewriteRule ^validate /c/php/controller.php?delegator=validator&action=get&resource= [QSA,NE,L]
# get the directory or a subset of it
RewriteCond %{QUERY_STRING} ^$ [OR]
RewriteCond %{QUERY_STRING} ^space [OR]
RewriteCond %{QUERY_STRING} ^filter [OR]
RewriteCond %{QUERY_STRING} ^api [OR]
RewriteCond %{QUERY_STRING} ^fmt
RewriteRule ^directory.json$ /c/php/controller.php?delegator=directory&action=get [QSA,NE,L]
# add a space to the directory
RewriteCond %{QUERY_STRING} ^recaptcha_challenge_field [OR]
RewriteCond %{QUERY_STRING} ^recaptcha_response_field [OR]
RewriteCond %{QUERY_STRING} ^url
RewriteRule ^directory.json$ /c/php/controller.php?delegator=directory&action=add&resource= [QSA,NE,L]
RewriteRule ^proxy\.php?(.*)$ /c/php/controller.php?delegator=proxy&action=get&$1 [QSA,L]
# TODO: fix the javascript which fetches filters.json one time and filterkeys.json the other time
RewriteRule ^filters.json$ /c/php/controller.php?delegator=filterkeys&action=get [L]
RewriteRule ^filterkeys.json$ /c/php/controller.php?delegator=filterkeys&action=get [L]
#RewriteRule ^filterkeys.json$ /cache/filter-keys/filter_keys.json [L] # L doesn't stop but goes to a new subprocess
# TODO: forbid the access of the template file
#RewriteRule ^template.html [F]
# If a file is requested that doesn't exist, then route to the app handler
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php [QSA,NE,L]
</IfModule>
# http://serverfault.com/a/50043
ErrorDocument 400 /error.html
ErrorDocument 401 /error.html
ErrorDocument 403 /error.html
ErrorDocument 404 /error.html
ErrorDocument 500 /error.html
ErrorDocument 503 /error.html
##################################################################################
# REFERENCE
##################################################################################
#
# Flags that alter metadata associated with the request (T=, H=, E=) have no affect
# in per-directory and htaccess context, when a substitution (other than '-') is
# performed during the same round of rewrite processing.
#
#
# B - escape backreference
# C|chain
# CO|cookie
# DPI|discardpath
# E|env
# END - Terminates the current round of rewrite processing and any subsequent rewrite processing from occurring in per-directory context.
# F|forbidden - Causes the server to return a 403 Forbidden status code to the client.
# G|gone
# H|handler
# L|last - Stop processing further rule sets. With the new URL mapping the rules are considered again though.
# N|next
# NC|nocase
# NE|noescape - Using the [NE] flag prevents special characters, such as & and ?, to be converted to their hexcode equivalent.
# NS|nosubreq
# P|proxy
# PT|passthrough
# QSA|qsappend - An existing query string is discarded by default. Using the [QSA] flag causes the query strings to be combined.
# QSD|qsdiscard
# R|redirect
# S|skip - The [S=N] flag is used to skip next N rules that you don't want to run.
# T|type - Sets the MIME type with which the resulting response will be sent.
#
#
# See https://httpd.apache.org/docs/current/rewrite/flags.html#flag_l