lee
lee

Reputation: 239

load a cdn hosted index.html onto site and use the cdn's resource instead

I have an index.html file that is hosted on a paid cdn server, and I want my website that is on a cheap webhost to load the index.html from the cdn server and use the cdn's resource instead.

I've tried:

<?php echo file_get_contents('http://cdn-hosted.com/index.html');?>

Everything loads fine, but it seems to be using my web host resource instead. Any suggestions instead of using iframe?

the cdn server doesn't render php codes.

Upvotes: 0

Views: 274

Answers (1)

jdog
jdog

Reputation: 2539

That this is served from your own server is totally expected. Your DNS records determine where a resource is loaded from.

If you really want to server you whole site from CDN, then make cdn-hosted.com an CNAME record of your website domain name, ie. www.yourwebsite.com or maybe just yourwebsite.com

Upvotes: 3

Related Questions