Ask
 
Answer
 
Forum
 
Debate
 
Blog
 
Categories
Entertainment & Music

Computers

Internet

Science & Mathematics

Health

Consumer Electronics

Sports

Society & Culture

Food & Drink

Education & Reference

 
More >>

 
Sign Up
Languages
English

Finnish

Arabic

Italian

Korean

French

Chinese(Traditional)

Chinese(Simplified)

Swedish

Czech

Hindi

Dutch

Norwegian

Russian

Croatian

German

Japanese

Bulgarian

Portuguese

Chinese

Spanish

Greek

 
Login


Remember:
Signin With:
 
OpenID

Google

Yahoo!

Facebook

Ning

 

Ok

Ask a Question



Search

Advanced

Topics

code computer difference download facebook file game internet justin linux money mysql name number online page php poptropica someone something system time ubuntu way web wii windows wordpress world year

More >>

Categories

  • ■Computers (19078) Subcategory Available
  • ■Internet (14465) Subcategory Available
  • ■Entertainment & Music (10042) Subcategory Available
  • ■Health (6866) Subcategory Available
  • ■Programming (6748) Subcategory Available
  • ■Video & Online Games (4994) Subcategory Available
  • ■Science & Mathematics (4123) Subcategory Available
  • ■Business & Finance (3899) Subcategory Available
  • ■Politics & Government (1666) Subcategory Available
  • ■Arts & Humanities (1653) Subcategory Available

More >>

Question Library

# A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  • Manage Blogs
  • Add Blog
  • All Blogs

 

 

Compressing JavaScript (And Other Types) Using .htaccess

By: Taley 1 month ago : Comments (0)
In Internet

I became aware that Google was going to use speed (loading time) as a factor in website ranking. Search results will rank higher than a competitor if the page is faster (or so it is said). I started thinking about it and it was pretty stupid not to reduce the speed as much as possible regardless of Google's decision. 

The Apache Way....
I started with the normal steps and modified apache2.conf. I'm using Ubuntu and Webmin so my structure is a bit different than normal. Modules are loaded in a mods-enabled folder in /etc/apache2/. mod_deflate was already being loaded into apache and I confirmed it. So I added these lines to my site configuration (held in /etc/apache2/enabled-sites):


<location>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/x-js text/css
</location>


I analyzed my website and it still did not work.  So I thought it was the mime types. I realized that it was x-javascript so I added:

<location>
    AddOutputFilterByType DEFLATE application/x-javascript
</location>


After restarting apache, it still did not work.  


The .htaccess Way....
I found a blog post that had a similar problem. The  writer, Scott, suggested adding this to .htaccess:

<ifmodule deflate_module="">
    <filesmatch> 
        SettOutputFilter DEFLATE 
     </filesmatch> 
</ifmodule>


After adding that and analyzing my website again, compression was found on all JavaScript files! Prototype was reduced to a mere 20k. My website was faster (loading at 60 seconds on dial-up). 

Sources:
http://www.techiegyan.com/?p=251
http://www.webperformancer.com/2009-08-31/configuring-apache-server-gzip-compression/
http://www.opensourcetutor.com/2009/06/01/how-to-compress-css-javascript-an-alternative-to-mod_deflate-or-mod_gzip/
http://joseph.randomnetworks.com/archives/2006/07/13/compressed-javascript/

  • Total views:  1183
  • Total comments:  0
  • Tick This

Rate Now: 1 2 3 4 Average Rating: 0.00 / 0 ratings

No comments posted

Disclaimer | Privacy Policy | Terms | Report Bugs | ■ RSS | Sitemap | Contact Us | ■ Invite | Create your Widget | ■ Twitter
■ Howto Tutorials | ■ Linux Questions | ■ Social Bookmarking | ■ Game Forums ■ Game Glitches/Hacks ■ Technology Blog ■ Money Blog

© 2009 QuestionBin. All rights reserved

QuestionBin does not evaluate or guarantee the accuracy of any QuestionBin content. Click here for the Full Disclaimer.