This question already has an answer here:
I have a template file that 'gets' the product url so that I can produce a link to the product. However, the url called is not the SEO friendly version. Can anyone suggest an edit to the code below so that I can get the preferred SEO friendly URL instead?
Preferred SEO Friendly URL
PHTML - My Current Code
<?php $product = $categoryProducts->getFirstItem();?> <a href="<?php echo $product->getProductUrl()?>">Product Link</a> <?php endif;?>