Jump to content
ABG_Building

[Contribution] .htaccess Optimisation V1.0

Recommended Posts

This is the support thread for .htaccess Optimisation.

 

Installation:

 

Upload the .htaccess file, or if you already have one, copy the text and add it to your .htaccess file.

 

What does it do?

 

This add-on will optimise your site, massively speeding it up, reducing your bandwidth usage and possibly increase your search engine ranking.

 

How?

 

In two ways, first, by compressing files that can be sent compressed, sometimes reducing file transfer size by upto 80%. Second, by controlling the cache, thus again reducing server load.

 

Link: http://addons.oscommerce.com/info/8927

Edited by ABG_Building

Share this post


Link to post
Share on other sites

Hi,

 

Would this work as is on a 2.2 site or is it specific to 2.3.x ?

 

Many Thanks


Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Share this post


Link to post
Share on other sites

Hi,

 

Gave this a try on my 2.2 sites and it appears to work great so far, with the following improvements:

 

Google Pagespeed

Was 55/100 and 67/100

Now 73/100 and 82/100

 

Pingdom

Was 85/100

Now 96/100

 

So a marked improvement on overall page performance - So Many Thanks

 

Would this .htaccess mod also work within my admin .htaccess to speed up admin tasks / pageload ?


Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Share this post


Link to post
Share on other sites

That is great to hear, almost a 20% improvement in one case!

 

I have another version that includes keep-alive, but I haven't noticed any real improvement using it, so I haven't bothered uploading it yet.

Share this post


Link to post
Share on other sites

Got an issue, as always :( landing pages loads fine but when clicking on any product I get a blank white page?

 

Please advise


-Peder Beckman-

Kool Kat Jazz Records

Share this post


Link to post
Share on other sites

Hi,

 

Would this work as is on a 2.2 site or is it specific to 2.3.x ?

 

Many Thanks

 

From my understanding of .htaccess, your admin should inherit functionality of the sites root .htaccess file. However, I cannot confirm that this is true under a .htacess password protected directory.


Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Share this post


Link to post
Share on other sites

I've never used GoDaddy, but I don't see any reason why it wouldn't work. It is easy enough to try though.

 

Will this work on a Godaddy account?

 

Thanks in advance!

Share this post


Link to post
Share on other sites

Did you install it correctly? If so, maybe you had already implemented these improvements in the past?

 

Hi

 

I just installed this module. It did not do anything my speed ratio is same as before.

Can someone help me .

Share this post


Link to post
Share on other sites

yea according to the instruction i put the code into my .htaccess file. The code i put was not there before.

That was simply copy and paste.

 

Here is the code which i put

 

 

<IfModule mod_headers.c>

<FilesMatch "\.(js|css|xml|gz)$">

Header append Vary Accept-Encoding

</FilesMatch>

</IfModule>

 

<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">

<IfModule mod_expires.c>

ExpiresActive on

ExpiresDefault "access plus 30 days"

</IfModule>

Header unset ETag

FileETag None

</FilesMatch>

 

# 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>

Share this post


Link to post
Share on other sites

Yeah i have apache server.I did not find <IfModule mod_headers.c> anywhere in my .htaccess.

I also installed this module on my other website it worked fine and it increased my website speed.

 

But this module is not working on my first website.

Share this post


Link to post
Share on other sites

Very strange. What Google PageSpeed and Pingdom scores are you getting?

 

 

Yeah i have apache server.I did not find <IfModule mod_headers.c> anywhere in my .htaccess.

I also installed this module on my other website it worked fine and it increased my website speed.

 

But this module is not working on my first website.

Share this post


Link to post
Share on other sites

This is very strange. I'm sorry, I don't know what the issue is. If you've uploaded the .htaccess to your root it should be working.

 

From first website PageSpeed 40/100

it was 40/100

 

From second PageSpeed 74/100

it was 32/100

Share this post


Link to post
Share on other sites

I expanded on this and noticed further improvements in the PageSpeed results. Read on...

 

First of all, I tested the site on the two websites provided. The results:

 

PageSpeed = 64/100 for mobile and 70/100 for desktop

Pingdom = 81/100

 

Then I added the htaccess changes recommended in the contrib. The results:

 

PageSpeed = 70/100 for mobile and 80/100 for desktop

Pingdom = 95/100

 

Then I added some additional lines to htaccess. The results:

 

PageSpeed = 77/100 for mobile and 84/100 for desktop

Pingdom = 97/100

 

Ok, so there was a marginal increase in the Pingdom score but there was a noticeable increase in the PageSpeed scores which are, of course, a Google test and, as such, are much more important in my book. So what additional changes did I make? I added the following lines after the ExpiresDefault

 

ExpiresByType image/jpg "access plus 1 month"

ExpiresByType image/jpeg "access plus 1 month"

ExpiresByType image/gif "access plus 1 month"

ExpiresByType image/png "access plus 1 month"

ExpiresByType text/css "access plus 1 month"

ExpiresByType text/html "access plus 1 week"

ExpiresByType application/pdf "access plus 1 month"

ExpiresByType text/x-javascript "access plus 1 month"

ExpiresByType application/x-shockwave-flash "access plus 1 month"

ExpiresByType image/x-icon "access plus 1 year"

 

Does anyone see any problems with doing this? I poked around on the site and didn't find any problems but I will report back if I do.

Edited by kru

Add-Ons personally installed:

Step by Step Manual Order -- Request Reviews -- Reviews in Product Listing -- Reviews in Product Display -- Review Approval System -- Leverage Browser Cache --
Header Tag Controller -- Multilayer SEO Pop Out Menu -- Follow Us Box -- View All Products -- USPS Shipping Labels -- UPS Shipping Labels -- Monthly Sales/Tax Report --
htacess Optimisation -- Remove Unused Images -- Master Password -- Admin Change Customer Password -- Database Backup Manager -- Zero Stock Report --
Searchbox Search In Descriptions -- Easy Populate 2.76i -- Barcode Rendering -- Admin Sort By Model -- Products Purchased Report

Add-Ons personally developed:

Search for email address, etc in Orders -- Discontinue Product

Add-Ons installed by others:

View Counter -- Site Monitor -- Image Thumbnailer -- Database Optimizer -- Recaptcha -- Discount Coupons -- Add More Fields

Share this post


Link to post
Share on other sites

Interesting little mod, for whatever reason google page speed likes this better than the code I was previously using, however yslow rates it the same.

 

One correction I would suggest is fixing the syntax, here is the fixed syntax along with a few more elements included for caching:

<IfModule mod_headers.c>
  <FilesMatch "\.(js|css|xml|gz)$">
    Header append Vary Accept-Encoding
  </FilesMatch>
</IfModule>
 
<IfModule mod_expires.c>
ExpiresActive on
<FilesMatch "\.(ico|jpg|jpeg|png|gif|swf)$">
ExpiresDefault "access plus 30 days"
</FilesMatch>
  <filesMatch "\.(css)$">
ExpiresDefault "access plus 5 days"
  </filesMatch>
  <filesMatch "\.(js)$">
ExpiresDefault "access plus 5 days"
  </filesMatch>
<filesMatch "\\.(xml|txt)$">
ExpiresDefault "access plus 1 hour"
</filesMatch>
<filesMatch "\\.(html|htm|php)$">
ExpiresDefault "access plus 1 hour"
</filesMatch>
Header unset ETag
FileETag None
</IfModule>

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Share this post


Link to post
Share on other sites

When I implement this I get an Internal Server Error.

You have to have mod mod_expires AND mod_headers enabled on your server. Also you may have cut and pasted incorrectly. Contact your friendly google search or system admin for further assistance enabling these. :)


Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Share this post


Link to post
Share on other sites

few trials errors loading product page

In my Cpanel optimize Website, select everything option

 

96/100 moblile 

72/100 mobile speed

86/100 desktop speed

 

The font awesome is stored on server

 

## ETAG CACHE ##
<IfModule mod_headers.c>
  <FilesMatch "\.(js|css|xml|gz)$">
    Header append Vary Accept-Encoding
  </FilesMatch>
</IfModule>
 
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf|woff|min.css|min.js)$">
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 30 days"
ExpiresByType font/ttf      "access plus 1 month"
ExpiresByType font/woff     "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>
Header unset ETag
FileETag None
</FilesMatch>
 
# 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>
## ETAG CACHE END ##

 

Any improvements pls post


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×