hey guys, i have quiet a number of .css and .js files on my website <head></head> pages. how do i compress them with gzip?
opjjuly
0
Newbie Poster
Recommended Answers
Jump to Postyou can specify filetypes for compression in apache's .htaccess file
<IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* </IfModule>
which acts on all files of the designated extension or mime
the …
Jump to Postthe script is two lines at the start of each file
…
and 1 line at the end
in this case rename files *.js to *.js.php(so php will process the file, and alter calls in the header to .js.php)
and add the first two lines before and the third line after
All 5 Replies
almostbob
866
Retired: passive income ROCKS
opjjuly
0
Newbie Poster
opjjuly
0
Newbie Poster
almostbob
866
Retired: passive income ROCKS
opjjuly
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.