-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
125 lines (98 loc) · 3.55 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#Fix Rewrite
Options -Multiviews
RewriteEngine on
# enable symbolic links
Options +FollowSymLinks
# this needs to be somewhere
# LoadModule http2_module modules/mod_http2.so
# ProtocolsHonorOrder On
# Protocols h2 http/1.1
#RewriteRule ^data/vendors/(.*)$ ../../vendor/$1 [R=301,NC,L]
# increase performance by disabling AllowOverride
# this htacces will be the default across the server
#AllowOverride None
# Disable directory browsing
Options All -Indexes
# Set the directory index
DirectoryIndex index.php
# Redirect Specific Files
RewriteRule ^favicon.ico Public/StatsCoach/img/icons/favicon.png [L]
# Remove www.
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Turn on https ( Cent OS )
#RewriteCond %{HTTPS} off
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Turn on https ( Mac OS )
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#prevent hotlinking
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://rootprerogative.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]
# protect against DOS attacks by limiting file upload size [bytes]
LimitRequestBody 10240000
# Enable compression
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
<IfModule mod_speling.c>
CheckSpelling On
</IfModule>
# set the default language
DefaultLanguage en-US
# pass the default character set
AddDefaultCharset utf-8
# Error Redirects
ErrorDocument 404 https://stats.coach/404/
# Version Control for Dependancies
RewriteRule ^(.*)\.[\d]{10}\.(css|js|html)$ $1.$2 [L]
# Redirect anyhting thats not of the following file types to the index
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteCond %{REQUEST_URI} !(\.png|\.jpg|\.gif|\.jpeg|\.bmp|\.icon|\.js|\.css|\.woff|.\woff2|\.map|\.hbs)$
RewriteRule (.*) index.php [QSA]
</IfModule>
# Everything to the index
RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d -- We dont want to redirect into direcotries
RewriteRule ^(.*)$ /index.php [NC,L,QSA]
# God forbit an uncaught error - Display contact method
#ServerSignature EMail
#SetEnv SERVER_ADMIN [email protected]
# 1 YEAR - 29030400; 1 WEEK - 604800; 2 DAYS - 172800; 1 MIN - 60
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, proxy-revalidate"
</FilesMatch>
# TODO - Eventually we should cache mustache files
# normally 60
<FilesMatch "\.(html|htm|php|hbs)$">
Header set Cache-Control "max-age=0, private, proxy-revalidate"
</FilesMatch>
# deny access to evil robots site rippers offline browsers and other nasty scum
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} ^Anarchie [OR]
RewriteCond %{HTTP_USER_AGENT} ^ASPSeek [OR]
RewriteCond %{HTTP_USER_AGENT} ^attach [OR]
RewriteCond %{HTTP_USER_AGENT} ^autoemailspider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Xenu [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus.*Webster [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus
RewriteRule ^.*$ http://www.cnn.com [R,L]
# send em to a hellish website of your choice