7

I have a category created which contains url key as - "sofa" and url generated is "sofa.html". URL rewrites system record generated as follows :

ID Path : category/5
Request path : sofa.html
Target Path : catalog/category/view/id/5

Now I want to run one of the custom module over that url(sofa.html) so I deleted system url rewrites and added custom url rewrites from the backend as follows :

ID path : alternate-sofa
Request path : sofa.html
Target path : alternate-sofa

So when I run sofa.html from the browser, I got the expected page from the custom module and it resolves the issue removing custom rewrites after reindexing, though after reindexing new system record added as follows :

ID path : category/5
Request path : sofa-1.html
Target path : catalog/category/view/id/5

Now, I am having issue as follows : On the page, I am listing out categories on left side which contains category url as "sofa-1.html" which is displaying my category layout instead of custom module. How to overcome this issue? I don't want to create sofa-1.html, sofa-2.html, onwards.

Edit : I refereed http://jc-designs.net/blog/2012/09/magento-adding-cms-pages-to-the-main-navigation/ and http://www.magentocommerce.com/knowledge-base/entry/adding-page-links-in-the-navigation-bar but when I set 301(permenant), url changed from "sofa.html" to "alternate-sofa" which is not expected url in the browser.

2

You cant simply prevent this, as there are cases, where it could make sense, like when you have products whith the same url key.

Additionally this is caused by a bug in magento, which has severel possible bugfixes, some of them described in Magento core_url_rewrite table excessively large

0

The way I handled -1 or -2 in the url's is making sure all index processes are done or set on manual index. Then in the URL Rewrite manager I search for all requested paths with -1 and remove them. Reindex catalog URL Rewrites and they should be resolved.

  • 1
    After reindexing, it has been added again because "sofa.html" already exist. – Kamal Jun 17 '14 at 7:32
0

You need to change the settings in admin under System -> Configuration -> Catalogue -> Catalogue -> Search Engine Optimisation -> Category URL Suffix - This should be ".html", you just need to change it to BLANK. Once done then delete all the entries from core_url_rewrite table for all the categories using the following query -:

DELETE FROM core_url_rewrite WHERE product_id IS NULL AND LENGTH(category_id)>0

N.B - Please take DB back up prior to run any update/insert/delete queries on production server

Hope it helps

Cheers S

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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