W
W
wscms2018-06-28 18:16:28
htaccess
wscms, 2018-06-28 18:16:28

Is it possible to do CDN routing via .htaccess?

There is an almost static HTML site, a lot of pages, a lot of pictures both in CSS backgrounds and in img src="xxxx"
It's not realistic to remake all the URLs by hand, but I want to send them through CloudFront from Amazon
Is there any point in such a construction in . htaccess

RewriteCond %{HTTP_USER_AGENT} !^Amazon\ Cloudfront$ [NC]
RewriteRule ^images/(.+)$ https://SomeId.cloudfront.net/images/$1 [R=301,L]

That is, the same img src="/images/same_img.jpg" remains in the HTML code, but we route to a CDN that already gives images

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-06-28
@dimonchik2013

it is possible, only your host will become a proxy, and the speed will be limited to your channel,
you need to change links in html files

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question