V
V
virus72016-04-03 01:35:36
htaccess
virus7, 2016-04-03 01:35:36

How to fix what PageSpeed ​​recommends?

.htaccess content

#AddHandler fcgid-script .php
# BEGIN WordPress

# BEGIN GZIP COMPRESSION BY RICHARD'S TOOLBOX
<IfModule mod_deflate.c>
  <IfModule mod_filter.c>
    # Declare a "gzip" filter, it should run after all internal filters like PHP or SSI
    FilterDeclare  gzip CONTENT_SET

    # "gzip" filter can change "Content-Length", can not be used with range requests
    FilterProtocol gzip change=yes;byteranges=no

    # Enable "gzip" filter if "Content-Type" contains "text/html", "text/css" etc.
    FilterProvider gzip DEFLATE resp=Content-Type $text/html
    FilterProvider gzip DEFLATE resp=Content-Type $text/css
    FilterProvider gzip DEFLATE resp=Content-Type $text/javascript
    FilterProvider gzip DEFLATE resp=Content-Type $application/javascript
    FilterProvider gzip DEFLATE resp=Content-Type $application/x-javascript

    # Add "gzip" filter to the chain of filters
    FilterChain    gzip
  </IfModule>

  <IfModule !mod_filter.c>
   #add content typing
  AddType application/x-gzip .gz .tgz
  AddEncoding x-gzip .gz .tgz

  # Insert filters
  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
  AddOutputFilterByType DEFLATE application/x-httpd-php
  AddOutputFilterByType DEFLATE application/x-httpd-fastphp
  AddOutputFilterByType DEFLATE image/svg+xml

  # Drop problematic browsers
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

  # Make sure proxies don't deliver the wrong content
  Header append Vary User-Agent env=!dont-vary
  </IfModule>
</IfModule>

<IfModule !mod_deflate.c>
    #Apache deflate module is not defined, active the page compression through PHP ob_gzhandler
    php_flag output_buffering On
    php_value output_handler ob_gzhandler
</IfModule>
# END GZIP COMPRESSION
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
 
 <IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access 7 days"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/html "access plus 7 day"
ExpiresByType text/x-javascript "access 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/x-shockwave-flash "access 1 year"
</IfModule>
<ifModule mod_headers.c>
<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(css|js)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</filesMatch>
<filesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=172800, private, must-revalidate"
</filesMatch>
</ifModule>
<IfModule mod_setenvif.c>
BrowserMatch "MSIE" force-no-vary
BrowserMatch "Mozilla/4.[0-9]{2}" force-no-vary
</IfModule>

Plugins tried everything
Who will advise what?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-04-03
@virus7

check that you give static
if nginx, you need to configure its
files with configs for nginx, you can see here
https://github.com/h5bp/server-configs-nginx

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question