If you want exclude category url from product url for new product you need enable setting from admin>system>catalog>Catalog>Search
engine Optimization> Use Categories Path for Product URLsmake it
noalso
Create Permanent Redirect for URLs if URL Key Changedit
yes`
Here some other trick
http://www.doingthing.com/blog/item/1164
http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/
Here the another process of This task...
Step1: create a backup core_url_rewrite
table with table data and it structure
.
Step2: create another duplicate table of core_url_rewrite
using my query
below:
CREATE TABLE `core_url_rewrite_dump` ( `url_rewrite_id` int( 10 ) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Rewrite Id',
`store_id` smallint( 5 ) unsigned NOT NULL DEFAULT '0' COMMENT 'Store Id',
`id_path` varchar( 255 ) DEFAULT NULL COMMENT 'Id Path',
`request_path` varchar( 255 ) DEFAULT NULL COMMENT 'Request Path',
`target_path` varchar( 255 ) DEFAULT NULL COMMENT 'Target Path',
`is_system` smallint( 5 ) unsigned DEFAULT '1' COMMENT 'Defines is Rewrite System',
`options` varchar( 255 ) DEFAULT NULL COMMENT 'Options',
`description` varchar( 255 ) DEFAULT NULL COMMENT 'Deascription',
`category_id` int( 10 ) unsigned DEFAULT NULL COMMENT 'Category Id',
`product_id` int( 10 ) unsigned DEFAULT NULL COMMENT 'Product Id',
PRIMARY KEY ( `url_rewrite_id` ) ,
UNIQUE KEY `UNQ_CORE_URL_REWRITE_REQUEST_PATH_STORE_ID` ( `request_path` , `store_id` ) ,
UNIQUE KEY `UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID` ( `id_path` , `is_system` , `store_id` ) ,
KEY `IDX_CORE_URL_REWRITE_TARGET_PATH_STORE_ID` ( `target_path` , `store_id` ) ,
KEY `IDX_CORE_URL_REWRITE_ID_PATH` ( `id_path` ) ,
KEY `IDX_CORE_URL_REWRITE_STORE_ID` ( `store_id` ) ,
KEY `FK_CORE_URL_REWRITE_CTGR_ID_CAT_CTGR_ENTT_ENTT_ID` ( `category_id` ) ,
KEY `FK_CORE_URL_REWRITE_PRODUCT_ID_CATALOG_CATEGORY_ENTITY_ENTITY_ID` ( `product_id` ) ) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT = 'Url Rewrites';
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
INSERT INTO `core_url_rewrite_dump` SELECT * FROM `magento1702v1`.`core_url_rewrite
Step4:
final run the below code
UPDATE `magento1702v1`.`core_url_rewrite` as p SET `target_path`=(SELECT rurl.request_path
FROM `core_url_rewrite_dump` as rurl
WHERE rurl.product_id IS NOT NULL
AND rurl.category_id IS NULL
AND rurl.product_id=p.product_id
LIMIT 0 , 1)
,`options` = 'RP'
WHERE p. product_id IS NOT NULL
AND p.category_id IS NOT NULL
Simon has a good answer but you can also do this through the admin control panel in Magento using a custom layout update setting on the category editor:
- Log in to your admin console and visit Catalog > Manage Categories.
- Select the category you want to change in the left column.
- Click the "Custom Design" tab in the middle column.
- Set "Use Parent Category Settings" to "No"
- inside the "Custom Layout Update" box add the following:
<remove name="header" />
<remove name="footer" />
- Save the category's changes and go check your website.
This will affect the selected category and all it's child categories by default. If you later want to change another category, you can repeat these steps on that category. You can also re-edit this category and reverse these steps to change the design of that category back again.
disclaimer
I tested this on 1.7 and I have just assumed that the same functionality exists in whichever version you are using.
Best Answer
You can solve this via admin setting in system->configuration->catalog->search engine optimization.
'Use Categories Path for Product URLs' set to no, and re-index url_rewrites.
This will remove the category from urls.