Permanently (301) Redirecting /home in Magento

By default, Magento creates index (homepage) at the /home permalink.

Without handling this correctly, this URL will be indexed by search engines and raise duplicate content issues between /home and /. By using the Magento URL Rewrite Management, you can permanently 301 redirect /home to / and block /home on your domain from being indexed in search engines.

In your Magento back office, head to Catalog >>URL Rewrite Management and ‘Add URL Rewrite’.

Type: Custom
Store: Select the appropriate store.
ID Path: home
Request Path: home
Target Path: ../
Redirect: Permanent (301)
Description: Redirects /home to /

You can also prevent search engines from crawling /home by adding the following in your website’s robots.txt file.

Disallow: /home/

Geoff Jackson

Geoff Jackson (more commonly known by his online pseudonym zigojacko) is the founder of Design Haven and The Clubnet Group which hosts numerous agencies including the most widely recognised of them, Clubnet Digital, a full service digital marketing and creative design/development agency. He also has a personal blog but it doesn't get updated as much as he'd like.

Sponsored Links...

Subscribe to Design Haven UK

Enter your email address to subscribe and receive our new posts by email.

18 Responses

  1. CJ says:

    Why ../ and not just / ??

    • Rewriting to just / in Magento’s URL Rewrite tool will not work, in order for this particular method to work, the target path has to be declared like ../

      • Me says:

        Actually doing ../ caused my redirect to take me to my website home page. My URL is domain.com/shop/home so putting ../ told it to go up a directory level, which puts you out of my store, and back at my site home page at domain.com/ In this case the solution is to put the full URL path as your destination. In my case instead of ../ i put https://www.domain.com/shop/

        • Yes, good catch, obviously the above should only be used if your Magento installation is located at the root of your domain. The target path should be modified accordingly if you are running Magento in a sub directory.

          For example: if /shop would become ../shop

  2. CJ says:

    Or why not use just .htaccess?

    • You could use mod_rewrite in .htaccess to deal with this particular rewrite and handle the 301 redirect but for many non-technical store owners, this will not be something they are familiar with nor comfortable doing… And they may possibly not even have access to either.

      This solution allows you to handle the issue out of Magento’s core directly in the admin back office making it far easier for most.

  3. CJ says:

    or better yet, use the FULL url as the target path: http://www.blah.com so it doesn’t have some odd redirect from ../

    • You can of course, use the full URL homepage path as the target redirection but if ever the store was moved to a different domain, then instances such as this, would have to be manually corrected.

      It proves far smoother to use relative paths making any future migrations easier and simpler without store owners struggling to see why the store is not behaving as expected.

  4. Alex says:

    fank man, realy works topik. 301 redirect ok by using admin panel on ngix hosting, but i have 502 error after apply it, but refresh the page – url saved. SEO in magento not perfect.

  5. good numbers says:

    Exactly what i was looking for ? It works with the latest version of magento as well ? I have seen lots of people struggling with this duplicate content issue. Hope this helps me.

    Thank you

  6. Sylvia says:

    Thanks, Geoff.  I’ve been looking for something like this as I’m trying to redirect a page to the home page, but I don’t want to redirect create an extra chain by redirecting /home to /.  It seemed to render correctly as a 301 for me from page1.html to ../ as seen in the browser.  But when I use an http status checker, it renders as 400.  Any info on that?

    • Hey Sylvia, if a reliable and accurate header response checker is returning a 400 error for the URL that you are trying to redirect then it is likely that it isn’t implemented correctly.

      Are you trying to use the built in URL Rewrite Management tool in Magento or manually creating a redirect in your sites .htaccess?

      Feel free to provide the real-case scenario with the URL’s of what you’re trying to redirect from and to and I can see if I can help.

      • Sylvia says:

        http://www.betterbraces.com/index3.html

        Here’s a real example, I set it up in magento redirects as a 301 to ../

        Some checkers show 400 and with a chrome extension ayima it shows 301.  I just need to make sure Google reads them as 301.

        • You have that domain redirecting from a .com to a .co.uk. You’ll probably find that the rewrite rule for handling the TLD redirect is interfering with your index redirect.

          The example you provide is going to return a 301 due to the above explanation. You need to 301 the .co.uk version to ../

          • Sylvia says:

            Oh interesting, I forgot you were in the UK.

            I guess technically that URL isn’t available in the UK which is why it is redirecting and 404.

            So if we simulate the URL as visited in the US, it is still seen as a 301?

            I’ll have to look into the UK piece as well.

            Thanks!

          • That’s not how domains with different TLD’s work Sylvia no. Regardless of whether the domain is co.uk or .com, visitors to that domain will see the same as everyone else.

            First establish your desired scenario. Should visitors be seeing the website on .co.uk or .com. Then forward the other version to the version visitors should see. Then work on your necessary redirects in Magento, for the correct domain (will likely be the same domain that you can access your Magento admin on).

            Without knowing your exact set up, it is difficult to advise exactly what you need to do to implement the redirect that this post discusses.

            Hope that helps.

          • Sylvia says:

            Hmm interesting, I’ll look into it.  Thanks again for your insight, Geoff!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: