-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.htaccess
112 lines (83 loc) · 2.86 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
# Prevent directory listings
Options -Indexes
# Follow symbolic links
Options +FollowSymLinks
# Disable implicit filename pattern match
Options -MultiViews
# Add additional MIME Types
AddType application/vnd.apple.pkpass .pkpass
AddType application/octet-stream .safariextz .ipa
AddType text/cache-manifest .manifest
AddType text/x-component .htc
# Automatically add utf-8 charset to files
<FilesMatch "\.(htm|html|php|asp|css|js)$">
AddDefaultCharset UTF-8
</FilesMatch>
#
# Reduce page size by compressing static data and save bandwidth
#
# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------
#
<IfModule mod_deflate.c>
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
# Compress all output labeled with one of the following MIME-types
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/html text/plain text/x-component text/xml
</IfModule>
</IfModule>
################################################################
# rewrite rules
<IfModule mod_rewrite.c>
# Enable rewrite rules
RewriteEngine on
RewriteBase /
###
## Standard Redirections
###
# Make note of URL scheme
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ - [env=scheme:https]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ - [env=scheme:http]
# Drop www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ %{ENV:scheme}://%1%{REQUEST_URI} [R=301,L]
###
## Standard Redirections
###
###
## HTTPS Redirection
###
# Force SSL (port 443)
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
###
## HTTPS Redirection
###
# Check for a PHP file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} .*/([^.]+)$
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php
# Check for an HTML file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} .*/([^.]+)$
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*?)/?$ $1.html
# Block .gitignore file from being accessed directly.
RewriteRule ^.gitignore$ 404 [R=301,L]
# Block README file from being accessed directly.
RewriteRule ^README(\.md)?$ 404 [R=301,L]
# active redirections
#Redirect 301 /source /destination
</IfModule>