Canonical URLs
Our website has been undergoing some routine maintenance lately. For example, we added some php code to enhance our header management and then we got a security certificate so we could serve up https pages. This, of course, created a bit of an SEO problem. Our visitors could now land on each page throughout the site in a variety of ways:
https://www.snapediting.com/index.html
https://www.snapediting.com
https://www.snapediting.com
https://www.snapediting.com/index
https://www.snapediting.com/index.php
So, it became imperative to create canonicals for each page. How did we accomplish this? Well, here is the code we added to the <head> section of the header php file (and, hopefully, someone can use it!):
<link rel="canonical" href="https://www.scriptol.com<?php echo $_SERVER['PHP_SELF']; ?>" />
Comments
comments powered by Disqus