Codeigniter with CDN
I am setting up a site using cms written with codeigniter, after finishing the website, I would like to move the whole asset to cdn.
all resource links are in an absolute path i.e. /image/logo.png,/css/index.css,/video/promo.mp4
Can i redirect all these assets to cdn without changing html
Thank you so much
+3
source to share
1 answer
(cannot help as it was rejected, I guess your question is not logic or best practice)
Basically, you can't just change that, since the CDN uses different domain / subdomain conventions, naming convention, and structure in general.
But you can try this;
- Assuming your webserver can use
.htaccess
and - Assuming the CDN will have the same folder structure and name.
:: Try to redirect the request to all images / resources in the CDN.
RewriteRule ([^.]+\.(jpe?g|gif|bmp|png|mp4|css|js))$ http://www.cdn-url.com/$1 [R=301,L,NC]
+3
source to share