How to change custom post type slug without damage seo?

Question

I need to change the structure of the taxonomy which holds a list of products, actually I have this implementation:

http://example.com/watches-product/category/product-name/

but this should be:

http://example.com/watches/product/category/product-name/

So actually I have to separate watches-product into watches/product, is possible do this without lose the SEO indexability?

This is the current code:

register_taxonomy('wpsc_watch_product_category', 'wpsc_watch_product', array(
    'hierarchical' => true,
    'query_var' => 'watch_product_category',
    'rewrite' => array(
        'slug' => 'watches-product'
    ),
    'labels' => $labels,
));

register_post_type('wpsc_watch_product', array(
    'capability_type' => 'post',
    'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),
    'hierarchical' => true,
    'public' => true,
    'show_ui' => true,
    'show_in_nav_menus' => true,
    'labels' => $labels,
    'exclude_from_search' => false,
    "publicly_queryable" => true,
    'rewrite' => array(
        'slug' => __('watches-product', "example") . '/%category%',
        'with_front' => true
    ),
    'taxonomies' => array('wpsc_watch_product_category'),
));

After this change (even if is possible) I would like that when an user visit the page:

http://example.com/watches-product/category/product-name/

the site will redirect him automatically to:

http://example.com/watches/product/category/product-name/

Thanks in advance

0
sfarzoso 1 month 2022-10-21T03:56:02-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse