Reputation:
I am using magento 1.7. magento product urls like http://example.com/men/silver-cufflinks
then i want to remove men
from url. i have commented following code in url.php
// if (null === $parentPath) {
// $parentPath = $this->getResource()->getCategoryParentPath($category);
// }
// elseif ($parentPath == '/') {
$parentPath = '';
// }
then empty core_url_rewrite table then clear cache and reindex all items and now i have urls like http://example.com/catalog/category/view/s/women/id/181/
. i want to restore previous links please tell me how i can do this. i also again try after uncomment code which i have commented and again clear tabel and clear cache and then reindex all things but still i cannot fix
Upvotes: 0
Views: 4421
Reputation: 1
I solved it by going to magento-catalog-click on the catalog in question, then going to the “url key” and changing it to what you want it to be. Make sure to change it in each store view and click “Save”.
Example:
Catalog
→ General Information
→ Name: Friends
→ Is active: Yes
→ URL key: friends
Store View: English French German
These changes will rewrite all the subcategories.
Upvotes: 0
Reputation: 25968
Have you enabled URL rewrite?
System -> Configuration -> Web -> Search Engines Optimization -> Use Web Server Rewrites = Yes
Additionally you can also check:
Catalog -> URL Rewrite Management
And this link: http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index
Upvotes: 0
Reputation: 995
After you uncomment the code try to clean up url-rewrite tables manually and then run url-rewrites reindex again.
Upvotes: 0
Reputation: 17656
Take a look @ Fixing URL Rewrites with Magento
To remove the category path from product urls, you can do it from the magento admin
Go to Admin -> System -> Config -> Catalog
Then under 'Search Engine Optimizations' set 'Use Categories Path for Product URLs' to 'No'
Upvotes: 1