Skip to content

WooCommerce redirects: Implementation, management, and troubleshooting

Redirects in WooCommerce are critical for proper site navigation, user experience, and SEO performance. When implemented correctly, they guide customers seamlessly through your store while maintaining search engine rankings. When done poorly, they create frustrating loops, broken customer journeys, and lost sales.

3D cartoon green gecko as store manager pointing at a redirect dashboard showing 301, 302, 307, 308 badges and flows (old-page → new-page) — WooCommerce redirects overview

I’ve seen countless WooCommerce stores struggle with redirect issues that silently damage their conversion rates. Let’s fix that by covering everything store owners and developers need to know about WooCommerce redirects.

Types of redirects in WooCommerce

WooCommerce relies on several types of redirects, each serving specific purposes:

HTTP status code redirects

  • 301 (Permanent): The gold standard when permanently moving content. Transfers SEO equity to the new URL.
  • 302 (Temporary): Use when temporarily redirecting traffic while preserving the original page’s SEO value.
  • 307 (Temporary): Similar to 302 but maintains the original HTTP method (GET remains GET, POST remains POST).
  • 308 (Permanent): Like 301 but preserves the HTTP method when redirecting.

WooCommerce-specific redirects

  • Login redirects: Where users go after logging in
  • Registration redirects: Where new customers land after creating an account
  • Logout redirects: Where customers go after signing out
  • Add-to-cart redirects: Whether to send users to the cart page or keep them on the product page
  • Checkout redirects: Where to send customers after completing a purchase
  • Empty cart redirects: Where to direct customers when they have an empty cart

Setting up basic WooCommerce redirects

Login, registration, and logout redirects

WooCommerce offers built-in options for these redirects under WooCommerce → Settings → Advanced → Account. Here you can specify:

  1. Where to send customers after login (default is “My Account”)
  2. Where to direct new registrations (default is “My Account”)
  3. Where to send customers after logout (default is the homepage)

For more advanced customization, use filter hooks:

// Custom login redirect
add_filter('woocommerce_login_redirect', 'custom_login_redirect', 10, 2);
function custom_login_redirect($redirect, $user) {
// Example: redirect to shop page
return wc_get_page_permalink('shop');
}

Add-to-cart redirects

By default, WooCommerce keeps customers on the product page after adding items to cart. To change this:

  1. Navigate to WooCommerce → Settings → Products → General
  2. Find “Add to cart behavior”
  3. Choose between “Stay on page” or “Redirect to cart”

For product-specific redirects, use this filter:

add_filter('woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect');
function custom_add_to_cart_redirect() {
// Redirect to checkout instead of cart
return wc_get_checkout_url();
}

Post-checkout redirects

To redirect customers after checkout to a custom thank you page:

add_action('template_redirect', 'custom_checkout_redirect');
function custom_checkout_redirect() {
if (is_order_received_page()) {
wp_redirect('https://yourstore.com/custom-thank-you/');
exit();
}
}

Remember: Always include exit() after a wp_redirect() to prevent further code execution.

Implementing site-wide redirect strategies

Using .htaccess (Apache servers)

For permanent redirects on Apache servers, add to your .htaccess file:

Redirect 301 /old-page /new-page
RedirectMatch 301 ^/old-category/(.*)$ /new-category/$1

Using WordPress plugins

Several plugins simplify redirect management:

  1. Redirection: Free plugin with robust logging and regex support
  2. Yoast SEO Premium: Includes redirect manager with automatic suggestions
  3. Rank Math: Free SEO plugin with redirect capabilities
  4. WP 301 Redirects: Simple, lightweight redirect manager

When choosing a plugin, consider:

  • Redirect volume (some handle thousands better than others)
  • Need for regex support
  • Logging capabilities
  • Performance impact

Programmatic redirects in WordPress/WooCommerce

For developers, implement redirects programmatically:

// Basic WordPress redirect
function programmatic_redirect() {
if (is_page('old-page')) {
wp_redirect('https://yourstore.com/new-page/', 301);
exit();
}
}
add_action('template_redirect', 'programmatic_redirect');

For PHP-level redirects (when WordPress functions aren’t available):

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://yourstore.com/new-page/");
exit();
?>

Critical: Place this code at the very top of your PHP file before any output is sent.

Common redirect pitfalls and how to fix them

Redirect loops

Symptoms: Browser shows “too many redirects” error.

3D cartoon green gecko troubleshooting a redirect loop and untangling a redirect chain (Too many redirects browser error, .htaccess and plugin icons) — redirect loop debugging

Fixes:

  1. Check for conflicting plugins redirecting the same URL
  2. Ensure you’re not redirecting to a URL that then redirects back
  3. Temporarily disable all redirects to identify the culprit

Login/registration redirect loops

Symptoms: Users can’t log in or register due to endless redirection.

Fix:

// Break login redirect loops
add_filter('login_redirect', 'fix_login_redirect_loop', 99, 3);
function fix_login_redirect_loop($redirect_to, $requested_redirect_to, $user) {
// Check if redirect is creating a loop
if (strpos($redirect_to, 'wp-login.php') !== false) {
return home_url();
}
return $redirect_to;
}

Cached redirects

Symptoms: Redirects continue working even after you’ve removed them.

Fixes:

  1. Clear your site cache
  2. Clear your browser cache
  3. Check for server-level caching (talk to your host)

Plugin conflicts

Symptoms: Redirects work intermittently or stop working after installing new plugins.

Fix: Disable plugins one by one to identify conflicts.

SEO implications of redirects

Redirects significantly impact your store’s SEO performance:

Best practices

  1. Use 301s for permanent changes: Tells search engines to transfer link equity
  2. Minimize redirect chains: Each hop loses some SEO value (A→B→C is worse than A→C)
  3. Redirect to equivalent content: Maintain topical relevance between old and new pages
  4. Create a redirect plan before migrations: Document all URLs requiring redirects before switching platforms or redesigning

Common SEO redirect mistakes

  1. Using 302s for permanent changes: Signals to search engines this is temporary
  2. Redirecting all old pages to homepage: Creates poor user experience and dilutes SEO value
  3. Not redirecting product variations: Each variant URL needs proper redirection
  4. Forgetting query parameters: Parameters like ?color=blue need appropriate handling

Using ContentGecko with WooCommerce redirects

When implementing ContentGecko’s automated SEO content strategy with WooCommerce, proper redirect handling becomes even more critical:

  1. Catalog sync: ContentGecko automatically updates content when product URLs change, but properly redirecting old URLs ensures you don’t lose ranking signals during catalog restructuring. Use the free keyword clustering tool to identify groups of keywords that should point to the same content.

  2. Content migration: When moving from manually-created content to ContentGecko’s automated system, implement proper 301 redirects from old blog posts to new content to preserve SEO equity.

  3. URL structure optimization: ContentGecko helps optimize your content structure for both users and search engines. Calculate the potential ROI of this optimization using the SEO ROI calculator.

  4. Content redirects during updates: When ContentGecko updates content to reflect catalog changes, ensure proper redirects are in place if URL structures change.

Advanced redirect techniques

Conditional redirects based on user roles

add_action('template_redirect', 'role_based_redirects');
function role_based_redirects() {
if (is_page('wholesale') && !current_user_can('wholesale_customer')) {
wp_redirect(home_url('/apply-for-wholesale/'));
exit();
}
}

Geo-based redirects

add_action('template_redirect', 'geo_redirects');
function geo_redirects() {
// Requires IP geolocation service
$country_code = get_visitor_country();
if (is_product() && $country_code == 'CA' && !is_page('shipping-restrictions')) {
wp_redirect(home_url('/shipping-restrictions/'));
exit();
}
}

Time-limited redirects

add_action('template_redirect', 'sale_redirects');
function sale_redirects() {
$sale_start = strtotime('2023-11-24 00:00:00'); // Black Friday
$sale_end = strtotime('2023-11-28 23:59:59'); // Cyber Monday
$current_time = current_time('timestamp');
if ($current_time >= $sale_start && $current_time <= $sale_end) {
if (is_front_page()) {
wp_redirect(home_url('/black-friday-sale/'));
exit();
}
}
}

Troubleshooting redirect issues

Diagnostic tools

  1. Redirect Checker: Use online tools like httpstatus.io to trace redirect chains
  2. Browser Developer Tools: Check Network tab for redirect status codes
  3. Redirect Mapper: Plugins like Redirection provide logs of triggered redirects

Step-by-step debugging process

  1. Identify the problem URL: Note the exact URL causing issues
  2. Check for plugin conflicts: Disable redirect plugins one by one
  3. Check .htaccess: Look for conflicting redirect rules
  4. Inspect theme functions.php: Search for hardcoded redirects
  5. Check WordPress hooks: Multiple plugins might use ‘template_redirect’
  6. Test in incognito mode: Eliminates browser caching issues
  7. Check server logs: May reveal redirect errors not visible in browser

Performance considerations

Excessive redirects slow down your site and hurt conversion rates:

  • Each redirect adds 200-300ms of load time
  • Mobile users are especially impacted by redirect delays
  • Google considers page speed when ranking sites

Use the website content generator from ContentGecko to create optimized landing pages that reduce the need for redirects in the first place.

TL;DR

Proper redirect management is essential for WooCommerce stores to maintain SEO value, provide smooth user experiences, and maximize conversions. Use 301 redirects for permanent changes, implement proper login/registration/cart redirects, and regularly audit your site for redirect issues. Consider tools like ContentGecko to automate content creation while maintaining proper URL structures. Always test redirects thoroughly before implementing them on production, and monitor analytics for unexpected traffic patterns that might indicate redirect problems.