Snap's Blog

Snap Editing Blog

Canonical URLs

11 November, 2019 | Improving SERP

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:

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="<?php echo $_SERVER['PHP_SELF']; ?>" />


    comments powered by Disqus