我们正在将一些映像迁移到CDN服务器。如果CDN中有可用的图像,则应从CDN获取图像,否则应从原始服务器获取图像。
例如:
Actual URL: https://myweb.com/training/images/image1
First It should redirect to below URL and get the image
CDN URI: http://mycdn.com/training/images/image1
if image not found in CDN, we should get the image from Actual URL
我们尝试了以下重定向规则。重定向到CDN URL正常,但后备无效。
RewriteCond https://mycdn.com/training/images/$1 -f
RewriteCond /training/images/$1 !-f
RewriteRule ^/training/images/(.*) https://mycdn.com/training/images/$1
我是apache重定向规则的初学者。有人可以帮我吗?