General Information about SEO
Because StackPath cache's copies of your website’s files on our servers, there is a chance that you can have Search Engine Optimization (SEO) issues with duplicate content. This scenario can happen because your files are now located on at least two different URLs, your origin server and the StackPath Secure CDN.
Web crawlers see your site the same way you do via your web browser, you don’t see duplicate images on your pages and neither do they. However both your origin server and the Secure CDN images can be indexed by these crawlers, so you need to consider what paths you want to allow for indexing through StackPath. This can be done by using our SEO settings where you can create a custom robots.txt for your site.
Our goal is to indicate the location of indexed files and to mark these files as only existing on your Secure CDN. The domain you send to the Secure CDN with your origin files is called a “Preferred Domain,” and it will be used to indicate to web crawlers the domain from which you want to index your files located on the Secure CDN. Ideally this will be the origin domain.
- To enable canonical header, navigate to Settings tab under your Site > CDN section and enable this option as shown on following image:
- If you still want to manage canonical header on origin side, below is the example of htaccess code you should be using to send a canonical header to the StackPath Secure CDN with the origin domain is “domain.com”:
- On your origin server, edit your htaccess file and insert this portion of code into it:
- Example of NginX configuration block:
- Enable custom robots.txt option under Site > CDN > Settings tab and define the allowed paths for indexing.
- Purge your StackPath Secure CDN cache, or wait for cache to expire if you have a cache hit percentage to maintain.
If you enable canonical headers within your StackPath CDN control panel you don’t have to do the same on your origin server, you can freely ignore htaccess and nginx configuration codes.