Automatic Canonical Link Tags in Symfony


<link rel=”canonical”
href=”<?php echo url_for($sf_context->getRouting()->getCurrentInternalUri(true), true); ?>” />


More information about the new canonical link tags can be found

3 thoughts on “Automatic Canonical Link Tags in Symfony

  1. i had a problem using this, because getCurrentInternalUri returned something like @route?a=whatever&b=somethingelse and the call of url_for ended up in a “missing mandatory parameter” because it could not handle &

    so i added str_replace(“&”, “&”, $internaluri)

Leave a Reply

Your email address will not be published. Required fields are marked *