Remarkably simple problem I have that I'm not finding a simple solution for.

Essentially I have a duplicate url issue with a Magento site's home page.

I have in the url structure the below:


but also:


Which essentially point to the same page.

I want to remove the latter url which has /home at the end.

I can't simply disable the CMS page that is the home page, as the home page then loads without the home page content in there.

All I want to do is essentially remove the /home from my sitemap generation and from Google's search index.

I still need the main url www.domain.com to index and be found though.

I'm finding that Google is not indexing my main url properly because of the duplication.

I would have thought there would be a basic setting in Magento admin to prevent this? Thanks for any help as always.

  • Anyone any ideas on an answer for this question? Seems relatively simple in nature but I can't find a simple way to achieve in default core Magento settings :(
    – MagentoMac
    Commented Nov 19, 2015 at 19:07

2 Answers 2


How to remove home identifier from the homepage url inside the generated sitemap.

(Tested on CE

  • Before: <loc>http://www.example.com/home</loc>

  • After: <loc>http://www.example.com/</loc>

Copy your Sitemap.php from:




Look for:

foreach ($collection as $item) {

and REPLACE IT with:

$pages = new Varien_Object();
Mage::dispatchEvent('sitemap_cms_pages_generating_before', array(
    'collection' => $pages,
    'store_id' => $storeId
foreach ($pages->getItems() as $item) {

then copy Page.php file from:




and open this too. Look for:

$page = $this->_prepareObject($row);

and REPLACE IT with:

if ($row['url'] == 'home') {
    $row['url'] = '';
$page = $this->_prepareObject($row);

Go to the backend, generate a brand new sitemap and Bob's your uncle! :D

  • Is it necessary to add the event in the file Sitemap.php ? Only extending the file Cms/Page.php will do the things ? Please let me know whether I can do this or not ? Commented Jan 23, 2019 at 12:19





Then try adding this code near line 202:

if ($item->getUrl() == 'home/') continue;

It should look similar to this:

foreach ($collection as $item) {
        if ($item->getUrl() == 'home/') continue;
        $xml = sprintf(
  • Thanks Alldo for the suggestion. I created a custom url 301 rewrite in the meantime which seems to have done the job. Waiting to check that the main homepage comes to the appropriate place in search rankings. if it doesn't, I'll remove it and try your suggestion. It looks fine though. Cheers.
    – MagentoMac
    Commented Nov 26, 2015 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.