How can I make a dynamic canonical tag on Magento?

We generally recommend to hide internal site search from getting indexed


Add this code:

// code for show canonical tag on all page
$current_url = Mage::helper('core/url')->getCurrentUrl();
$url2 = substr($current_url, 0, strpos($current_url, '?'));
if(!empty($url2)) {
<link rel="canonical" href="<?php echo $url2; ?>" />
<?php } else { ?>
<link rel="canonical" href="<?php echo $current_url; ?>" />
<?php } } ?>

Aly Chiman

Aly Chiman is a Blogger & Reporter at which covers a wide variety of topics from local news from digital world fashion and beauty . AlyChiTech covers the top notch content from the around the world covering a wide variety of topics. Aly is currently studying BS Mass Communication at University.