magento redirect particular category and its subcategory to homepage

I have one category in magento shop called shop online. I want to redirect this category and its sub category to the home page using the htaceess.
Tried this in htaccess to redirect
RedirectMatch 301 ^/shop-online/$ http://www.domainname.com/index.php

can anyone please help me…


Source: .htaccess

1 Comment

  1. Digin Dominic

    In Magento, it’s wrong to do redirects in .htaccess, but most newbies still solve the issue this way…. Your problem is that category urls in Magento usually have .html extension, so try this:

    RedirectMatch 301 ^/shop-online.html$ http://www.domainname.com/index.php

    The correct way is to create a url rewrite. In the admin, go to Catalog -> Url Rewrite Management. Create a custom URL Rewrite for your Shop Online category. If there’s already a url rewrite for your category (there will be one when the category is first created), delete it.

    Basically how url rewrites work is that Magento looks at the url and matches it to the Request Path in the screenshot. If it matches, it sends a location header to the Target Path.

    Reply

Leave a Reply