---
title: "Canonical URL With a Query String: When It's Fine and When to Fix It | bseoa"
description: "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 co…"
image: "https://www.blackseoanalyzer.com/static/images/black-seo-analyzer-og-image.png"
canonical: "https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/canonical-url-has-query-string"
language: "en"
---

# 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](https://www.blackseoanalyzer.com/en/blog/how-to-find-and-fix-every-broken-canonical-tag-on-your-site) 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

- [Add @type to Your Schema.org Data to Define Its Meaning](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/schema-org-data-missing-type)
- [Add Missing Content to Meta Tags for Better SEO](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/missing-content-in-meta-tag)
- [Add Missing Meta Tags to Improve SEO and Mobile Experience](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/missing-essential-meta-tag)
- [Add Open Graph Tags to Control How Your Content Appears on Social Media](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/no-open-graph-data)
- [Add Twitter Card Markup for Richer Sharing on Twitter](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/no-twitter-card-data)
- [Complete Your Open Graph Data by Adding Required Properties](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/missing-required-open-graph-property)
- [Complete Your Twitter Card Data by Adding Required Fields](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/missing-required-twitter-card-field)
- [Consider Using JSON-LD for Schema.org Implementation](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/schema-org-implemented-with-microdata)
- [Declare a Canonical URL for Every Page](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/missing-canonical-url)
- [Declare Only One Canonical URL per Page](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/multiple-canonical-urls)
- [Expand Short Meta Tag Content for More Impact](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/meta-tag-content-too-short)
- [Expand Your Meta Description to Improve Click-Through Rate](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/meta-description-too-short)
- [Fill in Empty Meta Tags to Improve SEO](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/empty-essential-meta-tag)
- [Fix Empty Canonical URL to Avoid SEO Issues](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/empty-canonical-url)
- [Fix Invalid Canonical URL Format](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/canonical-url-invalid-format)
- [Fix Invalid JSON-LD to Enable Rich Snippets in Search Results](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/invalid-schema-org-json-ld)
- [Fix Your Viewport Tag by Adding the initial-scale Property](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/viewport-missing-initial-scale)
- [Fix Your Viewport Tag by Adding the width Property](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/viewport-missing-width)
- [Improve Accessibility by Allowing Users to Zoom](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/viewport-disables-zoom)
- [Remove Fragment from Canonical URL for Better SEO](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/canonical-url-has-fragment)
- [Resolve Conflicting follow and nofollow Directives](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/conflicting-follow-and-nofollow)
- [Resolve Conflicting index and noindex Directives](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/conflicting-index-and-noindex)
- [Review noindex, follow Robots Directive](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/noindex-without-nofollow)
- [Secure Your Canonical URL by Using HTTPS](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/canonical-url-not-https)
- [Shorten Your Meta Description to Avoid Truncation in Search Results](https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/meta-description-too-long)

## 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.

[Download Free Trial](https://www.blackseoanalyzer.com/en/free-trial) [Purchase Single License](https://www.blackseoanalyzer.com/buy/single)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.blackseoanalyzer.com/#organization","name":"Fiscus Technology, LLC","url":"https://www.blackseoanalyzer.com/","logo":"https://www.blackseoanalyzer.com/static/images/black-seo-analyzer.png","founder":{"@type":"Person","name":"Seth Black"}},{"@type":"WebSite","@id":"https://www.blackseoanalyzer.com/#website","name":"bseoa","url":"https://www.blackseoanalyzer.com/","publisher":{"@id":"https://www.blackseoanalyzer.com/#organization"}},{"@type":"TechArticle","@id":"https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/canonical-url-has-query-string#article","headline":"Canonical URL With a Query String: When It's Fine and When to Fix It","name":"Canonical URL With a Query String: When It's Fine and When to Fix It","description":"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.","url":"https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/canonical-url-has-query-string","image":{"@type":"ImageObject","url":"https://www.blackseoanalyzer.com/static/images/black-seo-analyzer-og-image.png","width":1200,"height":630},"author":{"@type":"Person","name":"Seth Black","url":"https://www.blackseoanalyzer.com/about"},"publisher":{"@id":"https://www.blackseoanalyzer.com/#organization"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/canonical-url-has-query-string"},"inLanguage":"en-US","keywords":"technical SEO, SEO warning, Seth Black&#39;s SEO Analyzer"},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://www.blackseoanalyzer.com/"},{"@type":"ListItem","position":2,"name":"Technical SEO Warnings","item":"https://www.blackseoanalyzer.com/en/technical-seo"},{"@type":"ListItem","position":3,"name":"Canonical URL With a Query String: When It's Fine and When to Fix It","item":"https://www.blackseoanalyzer.com/en/technical-seo/metadata-analyzer/canonical-url-has-query-string"}]}]}
```
