- Why Change the Product URL?
- Change the Product Base
- Change the Slug of One Product
- Redirect Old Product URLs
- Common Mistakes
- FAQs About Changing the Product URL
- Does Changing the Product Base Hurt SEO?
- Do I Need to Change Every Product?
- Why Does the Old URL Still Load?
- Do I Need Code to Change the Product URL?
- Conclusion
Product URLs are part of how your store appears in search results and how customers read your catalog. WooCommerce builds every product link from a base, which defaults to /product/, plus the product slug. You can change both.
That’s what changing the WooCommerce product URL is for. This guide shows how to change the product base and individual slugs, and how to redirect old links so they keep working.
Why Change the Product URL?
A clear structure helps shoppers and search engines understand what a page is about. The product base sets a shared prefix for every product, and the slug sets the part unique to each product. Changing either one creates new URLs, so old links need 301 redirects. Plan the redirects before you change anything.
Change the Product Base
The base is a store-wide setting. Changing it moves every product URL at once.
Set the New Product Base
- Open the permalink settings. Go to WooCommerce → Settings → Products → Permalinks.
- Enter a new base. Type the new value in the Product base field, for example
item. Avoid a name that matches an existing page slug, such asshop. - Save. Click Save changes.
Flush the Rewrite Rules
WooCommerce refreshes its rewrite rules when you save the permalink page. If new product URLs return a 404 error, go to Settings → Permalinks in WordPress and click Save Changes. That rebuilds the rules without changing any settings.
Change the Slug of One Product
To change a single product, edit its permalink in the product editor. Only that product’s URL changes, so you only need a redirect for that one product.
- Open the product and click the permalink under the title.
- Edit the slug. Use lowercase words separated by hyphens, and keep the main keyword.
- Click OK, then update the product.
Tip: Rename slugs before a product gets much traffic. Each change creates a new URL that search engines have to discover and crawl again.
Redirect Old Product URLs
A 301 redirect tells browsers and search engines that a page has moved permanently, so old links still land on the right product. You can add redirects with a plugin or with code.
Use a Redirect Plugin
The free Redirection plugin lets you map an old URL to a new one in a table, without code. For a whole base change, create one regex rule that matches the old prefix and points it to the new prefix. Afterward, test a few URLs to confirm each one returns a 301 status.
Redirect the Old Base With PHP
After a base change, old URLs stop matching the rewrite rules and return a 404 error. This snippet catches 404s under the old base and redirects to the same slug under the new base, but only when a matching product exists. Adjust $old_base and $new_base to match your store.
<?php
add_action( 'template_redirect', 'my_redirect_old_product_base' );
function my_redirect_old_product_base() {
if ( ! is_404() ) {
return;
}
$old_base = '/product/';
$new_base = '/item/';
$path = wp_parse_url( wp_unslash( $_SERVER['REQUEST_URI'] ), PHP_URL_PATH );
if ( 0 !== strpos( $path, $old_base ) ) {
return;
}
$slug = trim( substr( $path, strlen( $old_base ) ), '/' );
$product = get_page_by_path( $slug, OBJECT, 'product' );
if ( ! $product ) {
return;
}
wp_safe_redirect( home_url( $new_base . $slug . '/' ), 301 );
exit;
}Tip: Check a redirect with
curl -Ion the old URL. Look for a 301 status line and alocationheader that points to the new URL.
Common Mistakes
- Changing the base without redirects. Every product URL changes at once, and every old link breaks.
- Reusing a page slug as the base. A base such as
shopcan clash with a page of the same slug, so the two compete for one URL. - Skipping the rewrite flush. If new URLs return 404 errors, save the permalinks page again.
- Creating redirect loops. A redirect that points back to a URL it also matches sends the browser in a circle. Test on staging before you go live.
FAQs About Changing the Product URL
Does Changing the Product Base Hurt SEO?
It can, if old URLs are not redirected. With 301 redirects in place, search engines follow the new URLs. Keep the redirects active for as long as the old links are likely to be used.
Do I Need to Change Every Product?
No. The base is one setting that applies to every product. Slugs are set per product, so you only need redirects for the products you rename.
Why Does the Old URL Still Load?
Usually a cache is serving the old page. Clear your page cache and any CDN cache, then load the URL again. If the old URL still loads after that, check that the redirect rule is active.
Do I Need Code to Change the Product URL?
Not for the base and the slugs. Code or a redirect plugin is only needed for redirects. Use the snippet above if you want redirects in your theme or a site plugin.
Conclusion
Changing the WooCommerce product URL comes down to three steps: set the product base, rename slugs one product at a time, and redirect every old URL before you publish the change. If you also want a clearer shop page URL, see the WooCommerce shop URL guide.
Need help with URL structure or redirects on a larger store? Hire a WooCommerce developer, or reach out to me directly.
