Server Gigabit Guide

How to Enable CDN for Static Website

You are here:
Estimated reading time: < 1 min

Enable CDN for Static Website

After create the CDN resources , the CDN resources now is ready to use.

If the website is a static website, there is 2 method to enable CDN.

1) Replace the image url

If previous website source code as below

HTML
<img src="http://URL/images/logos/big.jpg" alt="" />
<img src="images/logos/big.jpg" alt="" />

It need to replace as below

HTML
<img src="" alt="" />

2) If webserver do have Rewrite module enable, the rules as below could be apply

HTML
RewriteEngine ON
RewriteCond $1	!^.swf$ [NC]
RewriteCond $1	“\.(jpe?g|gif|png|bmp|ico|js|css|pdf|docx?|xlsx?|ppt|rar|zip|tar|gz|tgz|bz2|flv|avi|mov|wmv|mp3|wav|xml|txt)$” [NC]
RewriteRule ^(.*)  [L,R]
Was this article helpful?
Dislike 0
Views: 83