forked from delight-im/Localize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
44 lines (37 loc) · 2 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
# Disallow all HTTP methods other than GET, POST and HEAD
RewriteCond %{REQUEST_METHOD} !^(GET|POST|HEAD)
RewriteRule .* - [R=405,L]
# Prevent access to private/internal files
<Files ".gitignore">
Order allow,deny
Deny from all
</Files>
# Cache media files for one week
<FilesMatch "\.(js|css|gif|jpg|jpeg|png|ico)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
# Enable URL rewriting
RewriteEngine On
# Internal page URLs
RewriteRule ^projects/([a-zA-Z0-9_-]+)$ index.php?p=project&project=$1
RewriteRule ^projects/([a-zA-Z0-9_-]+)/languages/([a-zA-Z0-9_-]+)$ index.php?p=language&project=$1&language=$2
RewriteRule ^pages/([a-zA-Z0-9_-]+)$ index.php?p=$1
RewriteRule ^pages/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?p=$1&project=$2
RewriteRule ^review/([a-zA-Z0-9_-]+)$ index.php?p=review&project=$1
RewriteRule ^review/([a-zA-Z0-9_-]+)/languages/([a-zA-Z0-9_-]+)$ index.php?p=review&project=$1&language=$2
RewriteRule ^review/([a-zA-Z0-9_-]+)/languages/([a-zA-Z0-9_-]+)/edit/([a-zA-Z0-9_-]+)$ index.php?p=review&project=$1&language=$2&edit=$3
RewriteRule ^import/([a-zA-Z0-9_-]+)$ index.php?p=import&project=$1
RewriteRule ^export/([a-zA-Z0-9_-]+)$ index.php?p=export&project=$1
RewriteRule ^invitations/([a-zA-Z0-9_-]+)$ index.php?p=invitations&project=$1
RewriteRule ^add_phrase/([a-zA-Z0-9_-]+)/languages/([a-zA-Z0-9_-]+)$ index.php?p=add_phrase&project=$1&language=$2
RewriteRule ^phrases/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?p=phrase&project=$1&language=$2&phrase=$3
RewriteRule ^watch/([a-zA-Z0-9_-]+)$ index.php?p=watch&project=$1
RewriteRule ^verify/([a-zA-Z0-9_-]+)$ index.php?p=settings&verify=$1
RewriteRule ^settings/action/([a-zA-Z0-9_-]+)$ index.php?p=settings&action=$1
# Internal redirects
RewriteRule ^v/([a-zA-Z0-9_-]+)$ /projects/$1 [L,R=301]
# Block access to PHP easter eggs
RewriteCond %{QUERY_STRING} \=PHP[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12} [NC]
RewriteRule .* - [F]
# Block access to Markdown files in root directory
RewriteRule ^[A-Z0-9_]+\.md$ - [F]