codehaven - php snippets - coding help
Generic filters
Exact matches only
  • Adding Canonical link manually – PHP

    20th November 2020

    Php - Miscellaneous, SEO

    SEO category

    if you have a hand coded site to help with your SEO you need a canonical link.

    Below is a PHP script that creates a canonical url link on page load.
    So this should answer your question of how to add canonical tag in PHP
    This is a self-referencing canonical link

    Was this code snippet helpful?