My existing developed site image url is http://domain.com/assets/
at present we want to use CDN with pull
my CDN image url is http://cdn.cdndomain.com/
how to use cdn for my existing site.开发者_如何学JAVA We dont want to change existing html image paths. how to rewrite with .htaccess
?
Try to put this to your domain.com document root .htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^assets/(.*)$ http://cdn.domain.com/$1 [L,R=301]
Something to consider is that CDN providers will allow you to do the rewrites at the CDN edge network which will keep all the overhead of the rewrites away from your Origin servers.
精彩评论