-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.htaccess
60 lines (36 loc) · 2.15 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
# CORS options:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
php_flag display_errors on
# Apache by default prevents/strips the AUTHORIZATION HTTP header from being sent, so we have to enable it:
# Fix for Apache AUTHORIZATION HTTP header as it's stripped by default for security and should be enabled explicitly when needed:
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
# https://docs.oracle.com/cd/B14099_19/web.1012/q20206/mod/core.html#options
Options -Indexes
# Turn on the rewriting engine
RewriteEngine On
# If the browser has a URL of anything doesn't exist whether it's a d (directory) or f (folder), then proceed the rule below:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# Our routes (API Endpoints):
# Note: ^ and $ are REGUALR EXPRESSION METACHARACTERS
# Tasks:
RewriteRule ^tasks/([0-9]+)$ controller/task.php?taskid=$1 [L]
RewriteRule ^tasks/complete$ controller/task.php?completed=Y [L]
RewriteRule ^tasks/incomplete$ controller/task.php?completed=N [L]
# RewriteRule ^tasks/page/(.+)$ controller/task.php?page=$1 [L]
RewriteRule ^tasks/page/([0-9]+)$ controller/task.php?page=$1 [L]
RewriteRule ^tasks$ controller/task.php [L]
# Users:
RewriteRule ^users$ controller/users.php [L]
# Authentication:
RewriteRule ^sessions$ controller/sessions.php [L]
RewriteRule ^sessions/([0-9]+)$ controller/sessions.php?sessionid=$1 [L]
# Images:
# Retrieve or Update a certain image Attributes (GET or PATCH)
RewriteRule ^tasks/([0-9]+)/images/([0-9]+)/attributes$ controller/images.php?taskid=$1&imageid=$2&attributes=true [L]
# Handle Download a certain actual physical image of a certain (id) task (GET) Or Delete a certain physical image of a certain task (DELETE)
RewriteRule ^tasks/([0-9]+)/images/([0-9]+)$ controller/images.php?taskid=$1&imageid=$2 [L]
# Handle Creating (Uploading) an image for a certain task (POST)
RewriteRule ^tasks/([0-9]+)/images$ controller/images.php?taskid=$1 [L]