How can I fix a poorly formatted URL for better SEO on my e-commerce site?

Topic summary

A Shopify store owner encountered poorly formatted product URLs containing variant parameters (e.g., ?variant=24921424167012) that were being crawled by Google, negatively impacting SEO.

Problem identified:

  • URLs included variant query strings that created duplicate or non-user-friendly links
  • Shopify’s robots.txt limitations prevented blocking these parameters directly
  • The owner had already removed | within: collection code to improve URL readability

Solution provided:
A community member suggested modifying the product template code by changing enableHistoryState: true to enableHistoryState: false in the Shopify OptionSelectors JavaScript. This prevents variant parameters from appearing in the URL.

Outcome:
The original poster successfully implemented the fix, resulting in clean URLs without variant parameters. The solution was confirmed working with a provided example link.

Note: This approach removes the ability to create direct links to specific product variants, as only the main product URL will be accessible.

Summarized with AI on November 1. AI used: claude-sonnet-4-5-20250929.

I am facing the same issue. The URL is https://www.eeplindia.com/Electromagnetic-Flow-Meters.html

Help required