使用 CDN 提供来自 wordpress Shopp 插件的图像

发布于 2024-11-16 12:37:41 字数 439 浏览 4 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

琴流音 2024-11-23 12:37:41

查询字符串(? 之后的所有内容)无法在 RewriteRule 指令中匹配。

RewriteEngine on
RewriteRule ^shop/images/(\d+)/ http://cdn.example.com/shop/images/$1/ [NC,QSA,R=301]

上述规则仅匹配 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.

RewriteEngine on
RewriteRule ^shop/images/(\d+)/ http://cdn.example.com/shop/images/$1/ [NC,QSA,R=301]

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 format shop/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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文