This repository has been archived by the owner on Dec 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.htaccess
182 lines (151 loc) · 4.98 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# En linux el servidor debe de tener activado los siguientes modulos
# sudo a2enmod modulo
# rewrite mem_cache cache headers expires
# expose_php Off to show off php configuration
# SET GLOBAL query_cache_size = 16777216;
# SHOW VARIABLES LIKE 'query_cache_size';
# You can setup them in /etc/my.cnf (Red Hat) or /etc/mysql/my.cnf (Debian) file:
# vi /etc/my.cnf
# query_cache_size = 268435456
# query_cache_type=1
# query_cache_limit=1048576
php_value register_globals off
#expose_php Off
Header add x-content-type-options "nosniff"
Header add x-frame-options "SAMEORIGIN"
Header add x-xss-protection: "1; mode=block"
ContentDigest On
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
<IfModule mod_rewrite.c>
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]
# 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
#External Redirect .php files to .html files (SEO friendly)
#RewriteRule ^(.*)\.php$ /$1.html [R=301,L]
RewriteRule ^(.*)\.html$ $1.php [R=301,L]
</IfModule>
#############################################
SetEnv SERVER_ADMIN [email protected]
SetEnv TZ America/Mexico_City
ServerSignature Off
# enable symbolic links
Options +FollowSymLinks
# set the default language
DefaultLanguage es-MX
# 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>
<ifModule mod_php5.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>
Header add X-Enabled mod_gzip
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>
Header add x-enabled mod_deflate
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
<IfModule mod_headers.c>
Header append Vary User-Agent
</IfModule>
</IfModule>