forked from jackfiallos/Celestic-community
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_.htaccess
149 lines (124 loc) · 4 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# If you want get better performance enable the next modules
# sudo a2enmod _module_
# MODULES: rewrite mem_cache cache headers expires
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
Options +FollowSymLinks
Options All -Indexes
IndexIgnore */*
RewriteEngine on
# accept connection only using https
#RewriteCond %{HTTPS} !=on
#RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{THE_REQUEST} ^GET\ /.*\;.*\ HTTP/
RewriteCond %{QUERY_STRING} !^$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI}? [R=301,L]
# autoselect language
RewriteCond %{HTTP:Accept-Language} ^.*(es|pt|en).*$ [NC]
RewriteRule ^(.*)$ - [env=prefer-language:%1]
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php?r=site/login
#External Redirect .php files to .html files (SEO friendly)
#RewriteRule ^(.*)\.php$ /$1.html [R=301,L]
RewriteRule ^(.*)\.html$ $1.php [R=301,L]
#############################################
SetEnv SERVER_ADMIN [email protected]
SetEnv TZ America/Mexico_City
ServerSignature Off
# enable symbolic links
Options +FollowSymLinks
# set the default language
DefaultLanguage en-US
# set the default character set
<Files ~ "\.(htm|html|css|js|php)$">
AddDefaultCharset UTF-8
DefaultLanguage en-US
</Files>
# secure htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>
# preserve bandwidth for PHP enabled servers
<ifmodule mod_php4.c>
php_value zlib.output_compression 16386
</ifmodule>
# prevent acess to multiple file types
<FilesMatch "\.(htaccess|ini|log|sh)$">
Order Allow,Deny
Deny from all
</FilesMatch>
# headers caching
<ifModule mod_headers.c>
Header set Content-Language "en-US"
<filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|css)$">
Header set Cache-Control "max-age=29030400, public"
</filesMatch>
<filesMatch "\\.(js)$">
Header set Cache-Control "max-age=29030400, private"
</filesMatch>
<filesMatch "\\.(xml|txt)$">
Header set Cache-Control "max-age=29030400, public, must-revalidate"
</filesMatch>
<filesMatch "\\.(html|htm)$">
Header set Cache-Control "max-age=1, private, must-revalidate"
</filesMatch>
</ifModule>
# Force no caching for dynamic files
<FilesMatch "\.(php|cgi|pl|htm)$">
FileETag None
ExpiresActive Off
<IfModule mod_headers.c>
Header unset ETag
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</IfModule>
# order allow,deny
# deny from 127.0.0.
# deny from isp_name.com
# allor from all
</FilesMatch>
<FilesMatch "\.(html|htm|css|js|php|jpg|png|gif|ico)$">
FileETag None
<IfModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</IfModule>
</FilesMatch>
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css)$">
<IfModule mod_headers.c>
Header set Cache-Control "max-age=29030400, public"
Header set Expires "Mon, 31 Dic 2012 20:00:00 GMT"
</IfModule>
</FilesMatch>
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css)$">
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 year"
</IfModule>
</FilesMatch>
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|css|js|php|jpg|png|gif|ico)$
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_deflate.c>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
<IfModule mod_headers.c>
Header set P3P "policyref=\"/w3c/policy.xml\""
</IfModule>