Jump to content

Failed to add Expires Headers on Website


Recommended Posts

Hi there,

I tried to improve my cache system with adding .htaccess script to my root folder site , i have been added some script in .htaccess root then i test using GTMetrix and no changes.

Can anyone resolve or suggest? Thanks in advance

Link to comment
Share on other sites

On 4/27/2019 at 7:38 PM, El Patron said:

please post the gtmetrix results, note: native PS when it builds .htaccess set in performance page  'apache optimization' enabled.  

but without data it's only guessing what your issue is.  when writing a post consider what information you would need to solve and provide that.

Here it is sir

Untitled.thumb.png.8dd555d82b69dc94cb67fd730a2aad62.png

Link to comment
Share on other sites

is there another ways to add expires header? previous,  i've create add some htaccess script to add expire header . see below

<IfModule mod_expires.c>

#Activate

ExpireActive On

#For Images

ExpireByType  image/jpg "access plus 1 month"

ExpireByType  image/jpeg "access plus 1 month"

ExpireByType  image/png "access plus 1 month"

ExpireByType  image/gif "access plus 1 month"

ExpireByType  image/svg+xml "access plus 1 month"

</IfModule>

 

Is something wrong with the code?

Link to comment
Share on other sites

native PS will build an acceptable mod_expires 

what you need to do is find out if mod_expires is enabled on your hosting.  A basic way to test is by removing the IfModule surrounding the ExpireByType

 

<IfModule mod_expires.c>

</IfModule>

visit the shop and if you if you  receive a 500 error, it's not enabled.  (remember to put the IfModuule code back.

Contact you hosting but note:  many 'shared' hosting disallows mod_expries and upsell hosting that has mod_expires amongst other things...to be honest if shared hosting had mod_expires there would be little reason to get better hosting...(godaddy is famous for this :))

Also have seen similar issue when ngnix is in use as there are other hosting directives that  are required.

happy selling, el

 

Link to comment
Share on other sites

  • 1 year later...
On 4/29/2019 at 5:46 PM, El Patron said:

native PS will build an acceptable mod_expires 

what you need to do is find out if mod_expires is enabled on your hosting.  A basic way to test is by removing the IfModule surrounding the ExpireByType

 

<IfModule mod_expires.c>

</IfModule>

visit the shop and if you if you  receive a 500 error, it's not enabled.  (remember to put the IfModuule code back.

Contact you hosting but note:  many 'shared' hosting disallows mod_expries and upsell hosting that has mod_expires amongst other things...to be honest if shared hosting had mod_expires there would be little reason to get better hosting...(godaddy is famous for this :))

Also have seen similar issue when ngnix is in use as there are other hosting directives that  are required.

happy selling, el

 

This was the solution to my case also.

Hoster enabled mod_expires and all is passing ok now

Link to comment
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
×
×
  • Create New...