Improve SEO with a CDN
In this guide we will show you how to improve SEO with a CDN. We will look at how to use advanced settings to manage robots.txt, canonical headers and CORS headers.
Robots.txt
-
By default, CDNify allows robots to index your resources so bots can categorise and archive content.
-
Select “Stop robots from indexing your resource on the CDN?” to stop bots from crawling your resources and prevent content duplication from both the origin and CDN.
-
Test your resource by inputting it into your URL “yourresource.a.cdnify.io/robots.txt” - It will show Dissallow, which means bots cannot grab your resource’s content as it’s private.
CORS Headers
-
Most modern browsers need to know the origin of the resource, if it’s not explicitly stated it could throw an error.
-
Within Resource Settings, select “Enable CORS headers?” so the origin of the assets is set in the access control header.
-
Within the command line (Terminal for Mac, MS-DOS for Windows, and Bash for Linux), input
curl -I https://yourresource.a.cdnify.io
. It will show Access-Control-Allow-Headers: yourdomain.com, meaning your assets are now showing that they came from the origin.
Canonical Headers
-
Canonical headers tell the browser your asset origin, this helps to avoid content duplication in search engines.
-
Within resources, select the “Add an canonical link to your assets?” option.
-
To test open up your terminal and run the following command
curl -I https://yourwebsite.a.cdnify.io
replacing “yourwebsite” with the domain you want to test.