WordPress.org

Make WordPress Core

Ticket #10365: 10365.2.diff

File 10365.2.diff, 1.9 KB (added by Denis-de-Bernardy, 8 years ago)
  • wp-admin/includes/misc.php

     
    130130        if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
    131131                if ( got_mod_rewrite() ) {
    132132                        $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
     133                        $gzip = <<<EOS
     134<IfModule mod_headers.c>
     135# Make sure proxies don't deliver the wrong content
     136Header append Vary User-Agent env=!dont-vary
     137</IfModule>
     138
     139<IfModule mod_deflate.c>
     140# Insert filters
     141AddOutputFilterByType DEFLATE text/plain
     142AddOutputFilterByType DEFLATE text/html
     143AddOutputFilterByType DEFLATE text/xml
     144AddOutputFilterByType DEFLATE text/css
     145AddOutputFilterByType DEFLATE text/javascript
     146AddOutputFilterByType DEFLATE application/xml
     147AddOutputFilterByType DEFLATE application/xhtml+xml
     148AddOutputFilterByType DEFLATE application/rss+xml
     149AddOutputFilterByType DEFLATE application/javascript
     150AddOutputFilterByType DEFLATE application/x-javascript
     151AddOutputFilterByType DEFLATE application/json
     152AddOutputFilterByType DEFLATE application/x-json
     153AddOutputFilterByType DEFLATE application/x-httpd-php
     154AddOutputFilterByType DEFLATE application/x-httpd-fastphp
     155AddOutputFilterByType DEFLATE image/svg+xml
     156
     157# Drop problematic browsers
     158BrowserMatch ^Mozilla/4 gzip-only-text/html
     159BrowserMatch ^Mozilla/4\.0[678] no-gzip
     160
     161# IE5.x and IE6 get no gzip, but 7+ should
     162BrowserMatch \bMSIE\s[789] !no-gzip !gzip-only-text/html
     163# IE 6.0 after SP2 has no gzip bugs
     164BrowserMatch \bMSIE.+SV !no-gzip
     165# Opera occasionally pretends to be IE with "Mozilla/4.0"
     166BrowserMatch \bOpera !no-gzip
     167</IfModule>
     168
     169EOS;
     170                        $rules = $gzip . $rules;
    133171                        return insert_with_markers( $htaccess_file, 'WordPress', $rules );
    134172                }
    135173        }