Magento is appending '-1' only to certain categories URL key despite not being defined by us like that in backend.

Eg. if URL key for category 'sample' is 'sample' .. in frontend its showing as '/sample-1'

its not the case with all categories but 2 or 3 that too in desktop version alone.its working fine in mobile version

what could be the issue?

can anyone help ASAP?

  • Do you have URL rewrites with the same name? I'm guessing Magento is appending the '-1' due to it finding a conflict. – Dave Jul 3 '14 at 11:20
  • In URL rewrite also '-1' is appended in Target Path. but the URL key defined does not contain the suffix. – Swetha Jul 3 '14 at 11:23
  • In the URL rewrite table is there something already using the 'sample' key? – Dave Jul 3 '14 at 11:24
  • No its unique only. – Swetha Jul 3 '14 at 11:29
  • @Dave any idea on this scenario?? – Swetha Jul 3 '14 at 12:01

Usually this is the case when there is already a rewrite present with the same name. For instance if a product has the url: "test.html" and it has a permanent redirect to "test2.html" , trying to add a new product with "test.html" as URL key will not be possible since "test.html" is already redirecting to "test2.html". So maybe the URL is already present in your URL rewrite management?

Please check it out. If you do not longer need the redirect you can remove it and then you can change the url of the category to the URL you want without the suffix (-1 or -2 etc). If the URL doesn't exist (because you previously removed it) then it will be created without the suffix.

note: be careful if the url is already indexed in a search engine and you remove it, this can lead to 404 errors if you do not create a new one.

Hope this helps.

| improve this answer | |
  • @Marius Thanks a lot. I'll definitely try this out! – Swetha Jul 4 '14 at 4:50
  • Can you tell me what could be the root cause for this issue? – Swetha Jul 4 '14 at 5:50
  • Swetha, like I said the issue occurs when a permanent redirect is made for a certain product it keeps the old url in the rewrite management with a 301 redirect to the new url. The old url cannot be used since it is still there. – Sander Jul 4 '14 at 8:29
  1. Go to Catalog -> URL Rewrite Management
  2. Check in Request Path if "sample" already exists. If yes: Delete it. (Click on Edit then Delete)
  3. Delete also any sample-1 entries
  4. Go to System -> Index Management
  5. Click on Reindex Data for Catalog URL Rewrites

Be careful with any URL changes, it affects SEO! If this is a traffic page, mage sure you do a 301 redirect from sample-1 to sample.

| improve this answer | |

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.