Magento Forum

   
Page 1 of 2
Automatically-Generated URL Key for Category Problem
 
Sweet Tooth
Sr. Member
 
Avatar
Total Posts:  121
Joined:  2008-02-02
Canada
 

In the Catalog Categories section of the administration panel, I’ve noticed that if my Page Title has a quotation in it, like for example “Mother’s Day”, the URL key comes out as “mother-s-day”.  I understand that this could be Magento’s way of removing the comma, but all the links immediately after the creation of the “Mother’s Day” category that exist in the same level and parent-category for “Mother’s Day”, give 404 errors.  Changing the URL key from “mother-s-day” to “mothers-day” still did not resolve the issue.

Solution: Refresh Catalog Rewrites.

I hope somebody finds this information useful.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

You could also try fixing catalog URLS in - Admin > System > Cache management > Refresh Catalog Rewrites

 
Magento Community Magento Community
Magento Community
Magento Community
 
brahmam
Jr. Member
 
Total Posts:  1
Joined:  2010-11-08
 

I have same problem but i can’t find your navigation \"Admin > System > Cache management > Refresh Catalog Rewrites\” . \"Refresh Catalog Rewrites\” not available on cache management

 
Magento Community Magento Community
Magento Community
Magento Community
 
aboodred1
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-06-13
 

Hello

- First you need to rename your category URL key to something else;
- make sure to uncheck (Create Permanent Redirect for old URL);
- clear your cache by going to (main nav): system --> Cache Management --> clear ;
- reindex urls by going to (main nav): system --> Index Management --> check Catalog URL Rewrites --> reindex;

I hope it will help you out

 
Magento Community Magento Community
Magento Community
Magento Community
 
aboodred1
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-06-13
 

Hello

- First you need to rename your category URL key to something else;
- make sure to uncheck (Create Permanent Redirect for old URL);
- clear your cache by going to (main nav): system --> Cache Management --> clear ;
- reindex urls by going to (main nav): system --> Index Management --> check Catalog URL Rewrites --> reindex;

I hope it will help you out

 
Magento Community Magento Community
Magento Community
Magento Community
 
aboodred1
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-06-13
 

Hello

- First you need to rename your category URL key to something else;
- make sure to uncheck (Create Permanent Redirect for old URL);
- clear your cache by going to (main nav): system --> Cache Management --> clear ;
- reindex urls by going to (main nav): system --> Index Management --> check Catalog URL Rewrites --> reindex;

I hope it will help you out

 
Magento Community Magento Community
Magento Community
Magento Community
 
aboodred1
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-06-13
 

Hello

- First you need to rename your category URL key to something else;
- make sure to uncheck (Create Permanent Redirect for old URL);
- clear your cache by going to (main nav): system --> Cache Management --> clear ;
- reindex urls by going to (main nav): system --> Index Management --> check Catalog URL Rewrites --> reindex;

I hope it will help you out

 
Magento Community Magento Community
Magento Community
Magento Community
 
richbell20
Jr. Member
 
Total Posts:  5
Joined:  2010-09-07
 

I have a similar issue - i deleted my category by mstake, and when I readded the same category, it added a ‘-1’ to the end of it. I would like to be able to go back to just displaying the original url. How do i do this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
aboodred1
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-06-13
 

This what I will do if I have the same issue:

1. database backup
3. find core_url_rewrite, then empty table
4. delete var/cache
5. rename category key by removing -1 or any name you like
6. reindex catalog index rewrites in index management

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1839
Joined:  2009-06-04
 

Here’s a way to get rid of the -1 that’s been added to a category URL Key.

If you’ve taken the effort to add a truckload of Permanent Redirects because you’ve migrated from a previous e-commerce website, YOU DON’T WANT TO TRUNCATE/EMPTY THE core_url_rewrite TABLE. It deletes all your hard work on all those Custom RP rows you added and Google hates you by filling your logs with 404 errors and your customers hate you because they come in off some link somewhere and get a 404 error.

Here’s how to surgically change the URL Key. The “-1” gets added because a Permanent Redirect has been created for the original URL key, so we need to remove that reference to the bare URL Key.

Steps to change category url key “example-category-1” to “example-category”

1) In URL Rewrite management, find all path/to/example-category rewrites with option RP and delete.
Note the match path string, you want to search for the URL Key in the category path where you’re having the “-1” problem.

2) Change url key to ”example-category-x” and make sure Create Permanent Redirect is checked.
You want it to create a redirect from “example-category-1” to “example-category-x”

3) Change url key to ”example-category”, uncheck Create Permanent Redirect checkbox
It will change the rewrite from the previous step to redirect from “example-category-x” to “example-category”

4) Flush Cache

Do it the simple way, lose your Permanent Redirects and your competitors will love you for the extra traffic as customers give up in frustration.

 
Magento Community Magento Community
Magento Community
Magento Community
 
richbell20
Jr. Member
 
Total Posts:  5
Joined:  2010-09-07
 

Forigve me for sounding dumb, but i donot have a url rewrite management tab in my admin.

I’m using the latest version…

chiefair - 06 January 2012 06:13 PM

Here’s a way to get rid of the -1 that’s been added to a category URL Key.

If you’ve taken the effort to add a truckload of Permanent Redirects because you’ve migrated from a previous e-commerce website, YOU DON’T WANT TO TRUNCATE/EMPTY THE core_url_rewrite TABLE. It deletes all your hard work on all those Custom RP rows you added and Google hates you by filling your logs with 404 errors and your customers hate you because they come in off some link somewhere and get a 404 error.

Here’s how to surgically change the URL Key. The “-1” gets added because a Permanent Redirect has been created for the original URL key, so we need to remove that reference to the bare URL Key.

Steps to change category url key “example-category-1” to “example-category”

1) In URL Rewrite management, find all path/to/example-category rewrites with option RP and delete.
Note the match path string, you want to search for the URL Key in the category path where you’re having the “-1” problem.

2) Change url key to ”example-category-x” and make sure Create Permanent Redirect is checked.
You want it to create a redirect from “example-category-1” to “example-category-x”

3) Change url key to ”example-category”, uncheck Create Permanent Redirect checkbox
It will change the rewrite from the previous step to redirect from “example-category-x” to “example-category”

4) Flush Cache

Do it the simple way, lose your Permanent Redirects and your competitors will love you for the extra traffic as customers give up in frustration.

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1839
Joined:  2009-06-04
 

In 1.4.1.1, you go to the Catalog dropdown menu to find it. Catalog -> URL Rewrite Management

Not sure where it would be hidden in newer versions…

 
Magento Community Magento Community
Magento Community
Magento Community
 
morege
Jr. Member
 
Total Posts:  1
Joined:  2011-09-28
 

You get category-1.html instead of category.html because system doesn’t allow duplicate URL, go to the re writer to search for category.html then delete re writer records of all stores, then search category-1.html in rewriter, change back to category.html. re index category re writer. Good to go. same to re routed wrong URLs. Be careful, verify the information being deleted carefully avoid delete record you need and build new re write record carefully not to generate wrong record. Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mostafa_elkholy
Jr. Member
 
Total Posts:  28
Joined:  2011-04-04
 

Hello
I think Moreeg is right for me I tried so many ways but not success anymore.
First change the category URL to my old name. 
Second I Search in core_url_rewrite to select all the category name before and after CATNAME and CATNAME-x

SELECT *
FROM `core_url_rewrite`
WHERE `request_pathLIKE 'ÊTNAME%'
LIMIT 30 3000
then I delete them all
and flush cash and re-indexing after that all will be fine.

 
Magento Community Magento Community
Magento Community
Magento Community
 
PTPMedic
Jr. Member
 
Total Posts:  7
Joined:  2012-12-20
 
chiefair - 06 January 2012 06:13 PM

Here’s a way to get rid of the -1 that’s been added to a category URL Key.

If you’ve taken the effort to add a truckload of Permanent Redirects because you’ve migrated from a previous e-commerce website, YOU DON’T WANT TO TRUNCATE/EMPTY THE core_url_rewrite TABLE. It deletes all your hard work on all those Custom RP rows you added and Google hates you by filling your logs with 404 errors and your customers hate you because they come in off some link somewhere and get a 404 error.

Here’s how to surgically change the URL Key. The “-1” gets added because a Permanent Redirect has been created for the original URL key, so we need to remove that reference to the bare URL Key.

Steps to change category url key “example-category-1” to “example-category”

1) In URL Rewrite management, find all path/to/example-category rewrites with option RP and delete.
Note the match path string, you want to search for the URL Key in the category path where you’re having the “-1” problem.

2) Change url key to ”example-category-x” and make sure Create Permanent Redirect is checked.
You want it to create a redirect from “example-category-1” to “example-category-x”

3) Change url key to ”example-category”, uncheck Create Permanent Redirect checkbox
It will change the rewrite from the previous step to redirect from “example-category-x” to “example-category”

4) Flush Cache

Do it the simple way, lose your Permanent Redirects and your competitors will love you for the extra traffic as customers give up in frustration.

So.. Let’s say I did this the easy way already, but, I took a backup of the data table before truncating it. Now what I’d like to do is get all of my old re-directs back, also while then deleting the “-1” product re-directs. What would be my step by step process for restoring my old re-directs from the backup file, to then finally refreshing the URL re-directs to include my newer products added since the table was truncated about a month ago?

Edit: The reason I did this in the first place is the category I accidentally changed was the Root category and almost all 15,000 entries were rewritten to -1 at the end. Is it possible to select multiple rewrites? So far I have Magento 1.6.0.0 and I only have an option to edit 1 entry at a time in Magento, do you go to the phpMyAdmin to filter through the SQL table? Or are you talking of going through the Magento backend to find “RP” ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
MattStephens
Sr. Member
 
Avatar
Total Posts:  152
Joined:  2011-07-12
United Kingdom
 

If I understand your problem correctly, all your categories are now suffixed with “-1”?

If so you will need to delete from your core_url_rewrite table all urls that have a “request_path” ending in “-1”. Once these are deleted, you need to check that there are any other redirects being redirected to this wrong URL… This time check the “target_path” for those ending in “-1”.

Once these have been removed, if you re-run the Index Manager for the URL rewrites it “should” re-populate them correctly.

Essentially the “-1” URLs are created by Magento when there is already a redirect that exists for that URL.

So if you had a Honda category....

1) Originally its URL was; cars/honda/

2) And you then moved it inside the “International” category, its new URL would be; car/international/honda/. A redirect is added to core_url_rewrite

cars/honda >>> cars/international>honda

3) If you then wanted to move it back up one level there would already be a redirect for “cars/honda” pointing to the URL in step 2. Therefore it creates a new URL “cars/honda-1” and then after, adds a redirect for the URL in step 2 to this new “-1” URL.

cars/honda-1 >> catalog/category/view (the default action for rendering a category page)
cars/international/honda >>> cars/honda-1 (redirects step 2)

Essentially the process I outlined removes the original redirects to allow it to re-create the categories as they were.

Hope this makes sense.

Cheers
Matt

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2