Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
Author « Topic »  

drivers
Ecommerce Template Expert

USA
890 Posts

Posted - 03/08/2018 :  21:49:08  
I need to set cache expiration, but the site seems to ignore the htaccess file settings:

# One month for most static assets
<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
Header set Cache-Control "max-age=172800, public"
</filesMatch>

# One month for most static assets
<filesMatch ".(js)$">
Header set Cache-Control "max-age=300, public"
</filesMatch>

Is there a way to set this to where it is recognized?

does the session expiration need to go into the PHP at the top of each page?

When it gets late at night, go to bed... try again tomorrow.

Sinbad
ECT Moderator

USA
65937 Posts

Posted - 03/09/2018 :  08:08:49  
Hi Drivers, it only needs to be in the .htaccess file not on the store pages. You may want to check with the host that you are using the correct method for their web server,


I've used this method in the past, I don't put the css as css changes often.

<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"

# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>

Winners never quit, quitters never win
CSS and Responsive Designs
User Manual for Ecommerce Templates

drivers
Ecommerce Template Expert

USA
890 Posts

Posted - 03/09/2018 :  10:12:00  
Ill try that and report back

When it gets late at night, go to bed... try again tomorrow.

drivers
Ecommerce Template Expert

USA
890 Posts

Posted - 03/09/2018 :  10:24:09  
Its still not showing caching on gtmetrix.com's scans?

When it gets late at night, go to bed... try again tomorrow.

Sinbad
ECT Moderator

USA
65937 Posts

Posted - 03/09/2018 :  11:27:50  
Hi Drivers, you may want to check with the host that you are using the correct method for their web server. Example some host have caching features that are enabled in their cpanel where the user can select type of files and length of time.

Winners never quit, quitters never win
CSS and Responsive Designs
User Manual for Ecommerce Templates

drivers
Ecommerce Template Expert

USA
890 Posts

Posted - 03/09/2018 :  14:51:36  
Thanks for the info, Ill check that out and report back...

When it gets late at night, go to bed... try again tomorrow.

drivers
Ecommerce Template Expert

USA
890 Posts

Posted - 03/11/2018 :  23:55:56  
No special cache needs for host, nothing in cpanel... uploaded older backup htaccess and it worked well..must have been a missing symbol, or space, or dash, etc

When it gets late at night, go to bed... try again tomorrow.

wijayakusuma78
New Member

USA
93 Posts

Pre-sales questions only
(More Details...)

Posted - 03/12/2018 :  00:06:48  
Hi Drivers,
You can try this one

</IfModule>
# ======================================================
# Disable problematic ETag header since we are going to use Expires
# ======================================================
Header unset Pragma
FileETag None
Header unset ETag
# ======================================================
# Set Cache-Control and Expires headers
# ======================================================
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf|pdf|flv|mp3)$">
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 14 days"
Header set Cache-Control "public"
</IfModule>
</FilesMatch>
<FilesMatch "\.(html|htm|xml|txt|xsl)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>
# -----------------------------------------------------------------------
# Defining MIME types to ensure the web server actually knows about them.
# -----------------------------------------------------------------------
<IfModule mod_mime.c>
AddType text/css .css
AddType application/javascript js
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf ttc
AddType font/opentype otf
AddType application/x-font-woff woff
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
</Ifmodule>

Hok
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000