Canonical URL With a Query String: When It's Fine and When to Fix It

Metadata Analyzer

What is this warning?

The page's rel=canonical points to a URL containing a query string, such as ?page=2 or ?utm_source=newsletter. That's correct when the parameter changes the content, and a mistake when it's a tracking, session or sort parameter, which splits ranking signals across duplicate URLs.

How to Fix This Issue

How to Fix It

What this warning means

The page's canonical URL contains a ? query string. It's a review item rather than an automatic error, because some parameterized canonicals are intentional.

When a query string in the canonical is correct

  • Paginated series: page 2 should canonicalize to itself (/blog?page=2), not to page 1. Otherwise the posts linked only from page 2 lose a crawl path.
  • Sites whose real page URLs use parameters, for example /product?id=4812, where the parameter identifies the content.
  • Filtered or faceted pages you deliberately want indexed as landing pages, such as /shoes?color=red.

When it's a bug

  • Tracking parameters: utm_source, gclid, fbclid, ref.
  • Session or user identifiers: sessionid, sid.
  • Presentation-only parameters: sort, view=grid, currency.

The usual cause is a template that builds the canonical from the full request URL, so whatever parameters a visitor arrived with get copied into the tag:

<!-- request: /pricing?utm_source=newsletter -->
<link rel="canonical" href="https://example.com/pricing?utm_source=newsletter">

How to fix it

Build the canonical from the route or the stored page URL, not the raw request, and keep only parameters that change the content:

<link rel="canonical" href="https://example.com/pricing">

In a server framework this usually means using the request path instead of the full URL. In Flask, for example, use request.base_url or url_for(...) with _external=True instead of request.url. After deploying, crawl the site again with a few tracked URLs as start points and confirm the canonical no longer changes.

Why this matters

Google treats rel=canonical as a strong hint about which URL to index. A canonical that changes with tracking parameters asks Google to index many copies of one page, which splits links and makes Search Console reports harder to read. See how to find and fix every broken canonical tag for the rest of the canonical checks.

SEO Impact

This issue can affect your site's search engine rankings and user experience. Addressing it promptly helps ensure optimal performance and visibility in search results.

Automatic Detection

bseoa automatically checks for this warning during site analysis, along with hundreds of other technical SEO issues.

Other Metadata Analyzer issues

Ready to Unlock Your Site's Full SEO Potential?

Choose the license that fits your needs and start getting the deep, actionable insights you deserve.