In a recent Business Bloomer Club Slack thread, a WooCommerce user asked if it’s possible to remove the default “/product/” or the custom “/shop/” base from product URLs (product permalinks). The goal was to simplify the permalink structure, creating shorter, cleaner links instead of the rigid nested defaults.
While WordPress and WooCommerce do not provide a built-in toggle to achieve this out of the box, tailoring your URL architecture is highly beneficial for user experience and modern SEO branding.
Fortunately, with a plugin or the right combination of custom code filters and structural rewrite rules, you can cleanly bypass these default constraints.
In this step-by-step tutorial, we will break down exactly how to safely strip the unwanted prefixes from your store URLs, fix potential 404 routing errors, and implement automatic 301 redirects so you never lose your hard-earned search engine rankings.
Option 1: Use a WooCommerce Permalink Manager Plugin
The easiest and most reliable way to remove “product” or “shop” from the URL structure is by using a plugin like Permalink Manager for WooCommerce.
This plugin allows you to customize the WooCommerce URL structure, including removing slugs like “product,” “product_category,” and “product_tag.”
- Install the Plugin: Go to Plugins > Add New and search for Permalink Manager for WooCommerce.
- Configure Permalinks: Once installed, go to the plugin settings and choose options to remove or customize the product base.
- Save and Test: Save your new permalink structure and test product links to ensure there are no issues.
Option 2: Use Custom Code with Permalink Rewrite Rules
For those comfortable with code, you can add a snippet to your child theme’s functions.php file to adjust permalink structures by removing the product base. Note that custom rewrite rules can sometimes interfere with page URLs or cause compatibility issues with other plugins, so proceed carefully.
Also, you must resave the permalinks from the relevant WordPress settings page, otherwise the custom rewrites won’t work.
Case Scenario 1: Remove /product/ URL Base

In this case, we will try to move from the default permalink structure https://example.com/product/my-t-shirt to https://example.com/my-t-shirt , hence to remove the /product/ base:
/**
* @snippet Rewrite WooCommerce permalinks (remove /product/)
* @tutorial https://businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 10
* @community Join https://businessbloomer.com/club/
*/
add_filter( 'post_type_link', 'bbloomer_remove_default_product_base_links', 10, 2 );
function bbloomer_remove_default_product_base_links( $post_link, $post ) {
if ( 'product' !== $post->post_type || 'publish' !== $post->post_status ) {
return $post_link;
}
return str_replace( '/product/', '/', $post_link );
}
add_action( 'init', 'bbloomer_add_default_base_rewrite_rules' );
function bbloomer_add_default_base_rewrite_rules() {
$products = get_posts( [
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'fields' => 'ids',
] );
if ( empty( $products ) ) {
return;
}
$slugs = array_filter( array_map( function( $id ) {
return get_post_field( 'post_name', $id );
}, $products ) );
$product_slugs = implode( '|', array_map( 'preg_quote', $slugs ) );
add_rewrite_rule(
'^(' . $product_slugs . ')(/[0-9]+)?/?$',
'index.php?product=$matches[1]',
'top'
);
}
Important Considerations
- SEO and Redirects: Removing the product base can impact SEO, especially if your site has been live with the default structure for some time. Redirect old URLs to avoid broken links.
- Testing for Conflicts: Removing the “product” base could cause conflicts with pages, posts, or other custom post types, so be sure to test thoroughly.
Case Scenario 2: Remove /shop/ URL Base
In this case, we will try to move from the “Shop base” permalink structure https://example.com/shop/my-t-shirt to https://example.com/my-t-shirt , hence to remove the /shop/ base:
/**
* @snippet Rewrite WooCommerce permalinks (remove /shop/)
* @tutorial https://businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 10
* @community Join https://businessbloomer.com/club/
*/
add_filter( 'post_type_link', 'bbloomer_remove_shop_base_only_links', 10, 2 );
function bbloomer_remove_shop_base_only_links( $post_link, $post ) {
if ( 'product' !== $post->post_type || 'publish' !== $post->post_status ) {
return $post_link;
}
return str_replace( '/shop/', '/', $post_link );
}
add_action( 'init', 'bbloomer_add_shop_base_only_rewrite_rules' );
function bbloomer_add_shop_base_only_rewrite_rules() {
$products = get_posts( [
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'fields' => 'ids',
] );
if ( empty( $products ) ) {
return;
}
$slugs = array_map( function( $id ) {
return get_post_field( 'post_name', $id );
}, $products );
$slugs = array_filter( $slugs );
$product_slugs = implode( '|', array_map( 'preg_quote', $slugs ) );
add_rewrite_rule(
'^(' . $product_slugs . ')(/[0-9]+)?/?$',
'index.php?product=$matches[1]',
'top'
);
}
Case Scenario 3: Remove /shop/ URL Base from “Shop base with category”
In this case, we will try to move from the “Shop base with category” permalink structure https://example.com/shop/t-shirts/my-t-shirt to https://example.com/t-shirts/my-t-shirt , hence to remove the /shop/ base while keeping the product-category slug:
/**
* @snippet Rewrite WooCommerce permalinks (remove /shop/, keep product category)
* @tutorial https://businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 10
* @community Join https://businessbloomer.com/club/
*/
add_filter( 'post_type_link', 'bbloomer_remove_shop_base_from_links', 10, 2 );
function bbloomer_remove_shop_base_from_links( $post_link, $post ) {
if ( 'product' !== $post->post_type || 'publish' !== $post->post_status ) {
return $post_link;
}
return str_replace( '/shop/', '/', $post_link );
}
add_action( 'init', 'bbloomer_add_custom_shopless_rewrite_rules' );
function bbloomer_add_custom_shopless_rewrite_rules() {
// Get every product category slug
$terms = get_terms( [
'taxonomy' => 'product_cat',
'hide_empty' => false,
'fields' => 'slugs',
] );
if ( is_wp_error( $terms ) || empty( $terms ) ) {
return;
}
$cat_slugs = implode( '|', array_map( 'preg_quote', $terms ) );
// Only matches URLs whose first segment is an actual product category
add_rewrite_rule(
'^(' . $cat_slugs . ')/([^/]+)/?$',
'index.php?product_cat=$matches[1]&product=$matches[2]',
'top'
);
}
Conclusion
For a straightforward approach, use Permalink Manager for WooCommerce to remove “product” from your URLs. If you prefer a code-based method, custom rewrite rules can also work but may require additional troubleshooting. These solutions can help achieve a simplified, cleaner WooCommerce URL structure.








