By Engine23

Magento - Remove the trailing slash getUrl

Here is how you can use the URL key for a product, using getUrl and avoid the trailing slash

If you use

$box_url = Mage::getUrl('our-box.html');

and echo that string you will get something like


That of course is not right and you probably will get a 404 page. Unless you did a URL rewrite but that is another topic all together. Here is how to use the same function, but use a parameter instead

$box_url = Mage::getUrl('', array('_direct'=>'our-box.html'));

That will get us what is needed so echoing this string gets us