How to Make Breadcrumb URL SEO Friendly

breadcrumbs

so I have breadcrumbs in breadcrumbs.phtml and I don't know how to change their format for example I have this in $crumbs:

  [category1484] => Array
        (
            [label] => Laptop
            [link] => http://www.someweb.com/radioshack/catalog/category/view/s/laptop/id/1484/
            [title] => 
            [first] => 
            [last] => 
            [readonly] => 
        )

Instead I want to have the url keys for the breadcrumb so that I have like this:

http://www.someweb.com/radioshack/laptop

for example in products I could use to get urls like this:

 <a href="<?php  echo  Mage::helper('core/url')->getCurrentUrl()."/".$prod->geturl_key(); ?>"> 

But I do not have this option in bread crumbs should I customize breadcrumbs and start over or can I change the format?

We have url rewrites in just one store and we can show the products and categories by url_key but for breadcrumbs I have problem and if you ask why you have just for one store it is because we needed it to be faster so we kept it in just one store

Best Answer

Replace your breadcrumbs.phtml with this:

<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs">
<ul>
    <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
        <li class="<?php echo $_crumbName ?>">
        <?php if($_crumbInfo['link']): ?>
            <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
        <?php elseif($_crumbInfo['last']): ?>
            <strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong>
        <?php else: ?>
            <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
        <?php endif; ?>
        <?php if(!$_crumbInfo['last']): ?>
            <span>/ </span>
        <?php endif; ?>
        </li>
    <?php endforeach; ?>
</ul>
</div>
<?php endif; ?>

Ensure that:

System > Configuration > General > Web > Search Engine Optimizations > Use Web Server Rewrites = 'Yes'

System > Configuration > Catalog > Catalog > Web > Search Engine Optimizations > Product URL Suffix is empty 

System > Configuration > Catalog > Catalog > Web > Search Engine Optimizations > Use Categories Path for Product URLs = 'Yes' 

Reindex Catalog URL Rewrites

Flush Cache

Reload Page

Related Topic