There are many different ways to implement the StackPath CDN with your website. If you developed a custom website, we can help you integrate it with our StackPath services.
This tutorial assumes a CDN Site has been created in your StackPath Portal. If not, here is a walkthrough to create a StackPath CDN Site.
It's important to understand the difference between an origin URL and CDN URL before moving further in this tutorial.
An origin URL is a URL such as http://yourdomain.com that points to the main server. A CDN URL (or CNAME TARGET) is a URL automatically generated after a CDN Site is created. This looks like http://customerhash.stackpathdns.com. If a custom CDN URL is created using a CNAME record, the CDN URL looks like http://cdn.yourdomain.com.
If implementing the StackPath CDN with a custom-built site, go into the source code of the site and point static content to its corresponding CDN location. To do this, replace the origin URL with the CDN URL.
The location of files on CDN sites mirrors the location of static content on the origin server, so you do not have to edit the path. For instance, if there is a file on the origin located at yourdomain.com/images/logos/big.jpg, its location on our CDN would be http://something.stackpathcdn.com/images/logos/big.jpg.
Changing the URLs in your source code will look something like this:
<img src="ORIGIN_URL/images/logos/big.jpg" alt="" />
<img src="/images/logos/big.jpg" alt="" />
<img src="CDN_URL/images/logos/big.jpg" alt="" />
All you're doing is swapping the origin URL for the CDN URL.
Do not alter the URLs of pages and dynamic content, as dynamic content will not cache correctly.