使用 CDN 提供来自 wordpress Shopp 插件的图像
我在 shopp 安装中使用 CDN。我使用超级缓存来完成大部分设置,以便将我的内容放到 CDN 上。但是,数据库提供的图像(产品图像)不会从 CDN 中提取。我确实检查过它们是否存在于 CDN 上。
我知道你需要对 htaccess 文件做一些事情,这就是我到目前为止得到的
RewriteEngine On
RewriteBase /
RewriteRule ^.shop/images/(\d+)/?\?? (.)$ http://cdn.example.com/shop/images/$1/ ?2 美元[左,右=301]
但它似乎不起作用。有人知道解决方案吗?
I am using a CDN with my shopp installation. I used super cache to do most of the setup for getting my content on the cdn. However, the images that are served by the database (product images) are not being pulled from the cdn. I did check that they exist on the cdn.
i know that you need to do something to the htaccess file and this is what i got so far
RewriteEngine On
RewriteBase /
RewriteRule ^.shop/images/(\d+)/?\??(.)$ http://cdn.example.com/shop/images/$1/?$2 [L,R=301]
but it doesn't seem to work. anyone know a solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查询字符串(
?
之后的所有内容)无法在 RewriteRule 指令中匹配。上述规则仅匹配 URL,查询字符串(例如
?280,340,667194571
)将按原样传递(无需额外检查 - 有何用处?)。只要网址采用此格式shop/images/{some_digits_only}/
(例如example.com/shop/images/73/
),就会发出永久 重定向(301),浏览器中的URL将更改为CDN URL(例如http://cdn.example.com/shop/images/73/?280,340,667194571
)。The Query String (everything after
?
) cannot be matched in RewriteRule directive.The above rule only matches URL, the query string (e.g.
?280,340,667194571
) will be passed as is (no additional checks -- what for?). As long as URL is in this formatshop/images/{some_digits_only}/
(e.g.example.com/shop/images/73/
) it will issue Permanent redirect (301) and URL in browser will be changed to CDN URL (e.g.http://cdn.example.com/shop/images/73/?280,340,667194571
).