【问题标题】:add header expire for online script in htacess Magento在 htaccess Magento 中为在线脚本添加标头过期
【发布时间】:2014-05-01 09:35:54
【问题描述】:

您好,我需要在我的 magento 网站中添加一个标头到期。 下面是需要添加到期的脚本

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

我的 htacess 文件中有以下代码

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

请建议我如何为在线脚本添加到期时间谢谢

【问题讨论】:

  • 你不能。至少不是直接的。 your 服务器的Expires* 设置与另一个 服务器传递的文件无关。您需要在您的服务器和其他服务器之间使用代理服务器来完成此操作。

标签: .htaccess magento optimization online-storage


【解决方案1】:

根据我对您的问题的调查结果,这是不可能的,也不建议这样做。通过这个How can I add expire headers for scripts that are not on my server?

【讨论】:

    【解决方案2】:

    您不能为第三方提供的文件设置过期标头或任何标头。您的选择是:

    1. 将这些文件复制到本地并设置所需的标题
    2. 保持原样并忽略任何报告称缺少标题或其他任何情况

    只有在极少数情况下,我才看到使用 #1 的优势。否则,最好不要管它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-28
      • 1970-01-01
      • 1970-01-01
      • 2012-12-08
      • 2019-10-11
      相关资源
      最近更新 更多