Wednesday 5 June 2013

Magento - remove trailing slash from urls

Open app\code\core\Mage\Core\Block/Abstract.php and find the getUrl() method, it should just be one line of code that returns the requested URL:


return $this->_getUrlModel()->getUrl($route, $params);
Replace that line with the following:


$return_url = $this->_getUrlModel()->getUrl($route, $params);
if ($return_url != $this->getBaseUrl() && substr($return_url, -1) == '/' && !Mage::getSingleton('admin/session')->isLoggedIn()):
    return substr($return_url, 0, -1);
else:
    return $return_url;
endif;

1 comment:

  1. hi
    sir plz help me some Issue in magento framework

    ReplyDelete

Note: only a member of this blog may post a comment.