The osCommerce University Forums Welcome, Guest. Please login or register.
Did you miss your activation email?
March 12, 2010, 01:31:03 AM
Home osCommerce Courses CRE Loaded Book Store osC Max The Dean's Blog Zen Cart File Library eCommerce FAQ Education Forums Community Wiki Wiki Contact
News: Congratulations forum members! We now have over 534 posts and popularity around the net is becoming noticeable!

Print

Author Topic: Linux Apache .htaccess template to tweak performance on the web  (Read 1135 times)

0 Members and 1 Guest are viewing this topic.

Offline inetbiz

  • eCommerce Strategy Consultant
  • Administrator
  • Full Member
  • *****
  • Posts: 124
  • Karma: 22
  • SKYNET; T3; Apple Inc. Coincidence?
    • View Profile
    • Hosting for Creloaded Cart
Linux Apache .htaccess template to tweak performance on the web
« on: October 26, 2008, 04:14:40 PM »
You host must provide: mod_expires, mod_headers, mod_rewrite, .htaccess

Code: [Select]
# Remove -Multiviews if you show more than one character set
Options -Indexes -Multiviews

RewriteEngine on

# MJ12 Virus Bot
RewriteCond %{HTTP_USER_AGENT} ^MJ12bot/v1\.0\.8.*$
RewriteRule .* - [F]

RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]

<IfModule mod_deflate.c>
<FilesMatch "\.(js|css|htm?l)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A86400       
ExpiresByType image/x-icon A2592000
ExpiresByType application/x-javascript A7257600
ExpiresByType text/css A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/plain A604800
ExpiresByType application/x-shockwave-flash A604800
ExpiresByType video/x-flv A604800
ExpiresByType application/pdf A2419200
ExpiresByType text/html A600
</IfModule>

<IfModule mod_headers.c>
# 3 Month
<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$">
    Header set Cache-Control "max-age=7257600"
    FileETag MTime Size
</FilesMatch>
# 1 Week
<FilesMatch "\.(js|css|pdf|txt)$">
    Header set Cache-Control "max-age=604800"
    FileETag MTime Size
</FilesMatch>
# 10 Minutes
<FilesMatch "\.(html|htm)$">
    Header set Cache-Control "max-age=600"
    FileETag MTime Size
</FilesMatch>
# NONE Dynamic Files shouldn't have as much browser header information. It decreases load time and file size
<FilesMatch "\.(pl|php|cgi|spl)$">
    Header unset Cache-Control
    Header unset Expires
    Header unset Last-Modified
    FileETag None
    Header unset Pragma
</FilesMatch>

# Hide .htaccess
<Files .htaccess>
order deny,allow
deny from all
</Files>

Adding this can bring your Yslow rating up from a D to a B More factors are explained within the Firefox plugin. Image file size can play a large factor in your Yslow grade.

Print
+  oscommerceuniversity.com
|-+  eCommerce Discussions By Cart
| |-+  General Discussion
| | |-+  Linux Apache .htaccess template to tweak performance on the web
 


   EOS Design Center Zen Cart EOS Issue Tracker EOS Issue Tracker CRE Loaded Design Center CRE Loaded Design Wiki CRE Loaded Issue Tracker Sitemap

Powered by MySQL Powered by PHP Powered by SMF 2.0 RC2 | SMF © 2006–2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!