How to enable gzip compression for specific URL - gzip

How can I enable gzip compression for a specific URL link like this :
https://www.examples.com/compress.css
I tried :
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE text/css
</IfModule>
But it not works. Please advise.

Related

mod_deflate disabled: assets still being gzipped

When I execute:
sudo a2dismod deflate
sudo service apache2 restart
And refresh & inspect the response headers of my site in Chrome Web Tools, my assets (css and js) are still being marked as Content-Encoding : gzip. Y-Slow also confirms that all assets except the actual html document are still compressed.
I have output compression turned off in CodeIgniter's config file:
$config['compress_output'] = FALSE;
For what it's worth... though with the deflate module disabled I don't think it matters much, my /etc/apache2/mods-available/deflate.conf file is the system default:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
AddOutputFilterByType DEFLATE application/rss+xml
</IfModule>
I'm running Ubuntu 12.04. What else could be causing my assets to be compressed?
My .htaccess file is void of deflate commands.
You can try the following.
to disable the gzip for a specified file try this:
SetEnvIfNoCase Request_URI YOUR_FILE_NAME\.php$ no-gzip dont-vary
in you htaccess file. change YOUR_FILE_NAME\.PHP$ to what you need.
and to disable the gzip at all try this:
SetEnv no-gzip dont-vary
in your htaccess file.

127.0.0.1/asd does'not work on ubuntu environment

I was working on microsoft environment, but now I moved my website to ubuntu, the problem is, when I try to write a link like this, 127.0.0.1/asd, I get not found error, the thing that makes me crazy is, that URL sometimes work sometimes does not work and It was working great on windows environment, this is the error I get,
Not Found The requested URL /asd was not found on this server.
this is my .htaccess,
# compress text, html, javascript, css, xml:
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
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
RewriteEngine On
RewriteRule ^([//a-zA-Z0-9_-]+)$ tab.php?tab_id=$1 [QSA,L]
Your problem seems to be your rewrite rule - "//" should be "\/" - what does your apache conf file look like, does it have .htaccess enabled for that directory?

Gzip compression to html website through PHP

my website is in html and i want to enable gzip compression, my server has provided gzip compression through PHAR extension.
can you guide me how to do gzip .
I prefer to enable GZIP in the .htaccess, assuming your host allows you to change/add an .htaccess file. If they do, I write about how to enable GZIP:
#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
#End Gzip

How to enable GZip compression in Zend Server CE

I work with Falsh buider and httpserver.
To accelerate result display, I'd like to activate compression on Zend Server.
I create .htaccess on /usr/local/zend/apache2/htdocs/, like this:
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
# Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
I restart zend server, but compression seems to be desable.
Indeed on log, file size is the with compression and without.
So can you help me to solve that.
Thanks
You may need to add
AddOutputFilterByType DEFLATE application/x-amf
since you may be indicating that you are using Flash remoting
According your comment, I modify httpd.conf like that:
LoadModule deflate_module modules/mod_deflate.so
<Location />
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/xml application/xml application/x-amf
</IfModule>
</Location>
Now delate_module is loaded.
But when I launch httpservice from flex with e4X resultformat, result file has same size that without compression, Why?
Thanks for helping

Enable mod_deflate

I am trying to enable mod_deflate. I have Apache 2.0+ and tried this code in my .htaccess file:
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
It did not compress any of my files when I tested my site in firebug. What am I doing wrong?
As this'll be moved to SF soon, Shouldn't it be:
<FilesMatch "\.(js|css|html|htm|php|xml)$">
Otherwise the regex becomes \.js, for example (because you've escaped the '\').
SetOutputFilter DEFLATE
I used this and it worked. It was an internet history problem. My yahoo Yslow was saving the results from the first check so when I modified the htaccess the difference did not show up.