简体   繁体   中英

add header expire for online script in htacess Magento

Hi i need to add aa header expiry in my magento site. below is the script which needs to be add expiry

https://fonts.googleapis.com/css?family=Open+Sans:300,400,700 https://platform.twitter.com/widgets.js https://ssl.google-analytics.com/ga.js

i have a folowing code in my htacess file

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

# CSS
ExpiresByType text/css "access 1 month”

# Javascript
ExpiresByType application/javascript "access plus 1 year"

</IfModule>

Please suggest me how can i add expiry for online scripts Thanks

As of my findings on your question, It is NOT POSSIBLE and it is not recommended also. Go through this How can I add expire headers for scripts that are not on my server?

You cannot set expiry headers or any headers to files that are served from a third party. Your options are:

  1. Copy those files locally and set your desired headers
  2. Keep it as is and ignore any reports saying headers missing or whatever

Only in rare cases I see advantage in using #1. Otherwise, your best bet is to leave it alone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM