简体   繁体   中英

Deflate and Gzip not working in Htaccess

I have set deflate in htaccess but its not working. Mod deflate is enable on server. Here is my code of htaccess:

<IfModule mod_deflate.c>
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
DeflateCompressionLevel 1
</ifModule>

First, you need to check if mod_defalte.c is running.

eg

<ifmodule mod_deflate.c>
Redirect 302 / https://www.google.com/
</ifmodule>

Then go and load your website and see if you are getting redirecting google or not.

Do you have allowoverrides enabled in Apache config (httpd.conf etc)

http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

If not, then no htaccess config will have any effect

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM