Check home page URL in magento

Home / Magento / Check home page URL in magento

Check current page is home page in magento

If you want to check current page is home page or not in magneto below code is helpful to you.

<?php 
if(
Mage::getSingleton('cms/page')->getIdentifier() == 'home'  &&
Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' 
) : 
?>

The other way you can check current page is home page or not in magento

<?php
if($this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true))):
	echo "Homepage";
else:
	echo "Not in Homepage";
endif;
?>

Related Posts

Leave a Reply

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