[英]http compression with htaccess not working
I have the following setup - it may seem a bit strange, but the environment forces me to redirect so much: 我有以下设置-似乎有些奇怪,但是环境迫使我进行了大量重定向:
.htaccess file: .htaccess文件:
<ifModule mod_deflate.c> SetOutputFilter DEFLATE AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript font/ttf font/woff image/svg+xml application/vnd.ms-fontobject </ifModule> RewriteEngine On RewriteRule ^tools\\.js$ tools.php [NC]
the file tools.php: 文件tools.php:
<?php require ('javascript.php');
the file javascript.php: 文件javascript.php:
<?php header('Content-type: text/javascript; charset=utf-8;'); // etc. ?>window.onpagehide = function(e) {document.getElementById('someElement').style.display = 'none';}; var x = ''; //etc.
I want the file (" http://example.com/tools.js ") to be gzipped (deflated) when served by Apache. 我希望文件(“ http://example.com/tools.js ”)在由Apache提供服务时被压缩(压缩)。 It doesn't do it. 它没有这样做。 It does correctly deflate a normal css file in that same folder, though. 但是,它确实可以正确缩小同一文件夹中的普通CSS文件。
What do I need to fix this? 我需要解决什么?
Check your PHP config (php.ini), to make sure it has the following line: 检查您的PHP配置(php.ini),以确保其具有以下行:
zlib.output_compression=On
Source: How to enable GZip compression in XAMPP server 来源: 如何在XAMPP服务器中启用GZip压缩
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.