-
Notifications
You must be signed in to change notification settings - Fork 4
/
.htaccess
43 lines (31 loc) · 1.58 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
# Start A2 Switcher Block
# Do not remove or modify this block! Added by PHP Switcher from cPanel to use an alternate PHP version. Contact Support for details.
<IfModule mod_suphp.c>
AddHandler application/x-httpd-php-5.5.0 .php
</IfModule>
# End A2 Switcher Block
# Prevent Apache from serving .ht* files:
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>
# Don't allow access to .ini files
<files *.ini>
order allow,deny
deny from all
</files>
#redirect to php api controller
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.trackyourclimb.com [NC]
RewriteRule ^(.*) http://trackyourclimb.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#These rules say that if the requested URI does not match an existing file or directory name (ex. trackyourclimb.com/workout-input.php), then try the following rewrite rule.
RewriteRule api/v1/(.*)$ api/v1/api.php?request=$1 [QSA,NC,L]
#This rule ([^\.]+) can be broken down as such: '^' means 'not', \. is an escaped period, and '+' matches 1 or more characters. So this matches all the characters that don't include a period character.
#match URI and redirect (ex. trackyourclimb.com/api/v1/users/user/1 should redirect to trackyourclimb.com/api/v1/api.php?request=users/user/1
#the flag [QSA] means that the named capture will be appended to the newly created URI
#the flag [NC] means that the URIs are not case-sensitive
#the flag [L] means that the mod_rewrite should not provide any additional rules if this rule matches
</IfModule>