How to Fix Duplicate URL Variants (Case, Slash, Index)

Your site serves the same page at several addresses, such as /Services, /services/ and /services/index.html, and none of them names a preferred version. By the end of this guide you will have chosen one URL format, 301-redirected the variants to it, set absolute canonical tags, and cleaned up internal links and the sitemap.

By Updated ⏱ 45-90 minutes🎯 Intermediate● High impactTechnical
Illustration: Duplicate URL variants fix guide
TECHNICAL · FIX GUIDE Duplicate URL variants IMPACTEFFORT TIME45-90 minutes LEVELIntermediate

Why it matters

When /about and /About/ both return 200 with no canonical, Google has to guess which to index. Links, crawl budget and ranking signals get split between the copies, and the wrong variant can show up in results or AI answers. Analytics also splits the page into several rows, so you underestimate its traffic.

Each crawl of a variant spends budget that could have gone to new content.

✕Beforehttps://example.com/Pricing,https://example.com/pricing/ andhttps://example.com/pricing/index.html✓AfterAll three 301-redirect tohttps://example.com/pricing, whichreturns 200 with <link rel="canonical"

What you need

Access to server config (.htaccess, Nginx) or your CMS/CDN redirect settings
Ability to edit the <head> template or SEO plugin settings
A crawler such as Screaming Frog, Sitebulb or our audit report
curl or a browser redirect checker

Step-by-step fix

1

List the URLs that collapse into one

Crawl the site and export every URL that returns 200. php. Any URLs that end up identical are a duplicate group.

The usual sources are:

  • Internal links with mixed case, e.g. /Blog vs /blog
  • Menus linking /contact/ while the footer links /contact
  • Old static links to /index.html or /index.php

Note that query-string variants (?ref=, ?utm_) are a separate issue. Cover them with canonical tags.

Pro tip: In Screaming Frog, use Bulk Export > All Inlinks on the duplicate URLs. This shows which templates create the bad links.
2

Pick one URL convention and write it down

Choose lowercase only, one trailing-slash rule (with or without, site-wide), and no index file names. Match whatever most of your indexed URLs and backlinks already use, so you have fewer redirects to manage. com/) always keeps its slash.

That is fine.

text
Convention for example.com:
- https only, no www
- lowercase paths
- no trailing slash (except the homepage)
- never expose index.html / index.php
Pro tip: Check Google Search Console > Pages > 'Duplicate, Google chose different canonical than user'. It shows which format Google already prefers.
3

301-redirect trailing-slash and index variants

Send every variant to the chosen form in a single hop. The examples below strip the slash and the index file. If your convention keeps the slash, reverse the slash rule.

Test in staging first, because a bad rewrite can loop.

apache
# Apache (.htaccess)
RewriteEngine On
# /dir/index.html or /dir/index.php -> /dir
RewriteCond %{THE_REQUEST} \s/+(.*?)/?index\.(html?|php)[\s?] [NC]
RewriteRule ^ /%1 [R=301,L]
# /page/ -> /page (skip real directories)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]

# Nginx (server block)
if ($request_uri ~* "^(.*?)/?index\.(html?|php)(\?.*)?$") { return 301 $1$3; }
rewrite ^/(.+)/$ /$1 permanent;
Pro tip: Use 301 (or 308), never 302. A temporary redirect does not consolidate signals reliably.
4

Redirect uppercase URLs to lowercase

Apache can do this with a RewriteMap. htaccess. Plain Nginx has no lowercase function, so use a CDN rule, the Lua or Perl module, or application middleware instead.

If you cannot redirect, a canonical tag pointing to the lowercase URL also clears the check.

apache
# Apache vhost config
RewriteMap lc int:tolower

# vhost or .htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
Pro tip: Exclude case-sensitive paths such as file downloads or signed asset URLs before you switch this on.
5

Add a hardcoded absolute canonical tag

Every page needs a canonical tag that points to the preferred URL, built from the page's stored slug. Do not echo back the requested URL. com/Pricing/, it is still a self-referencing duplicate and the problem stays.

Use the full https URL, lowercase, in the chosen slash format.

html
<link rel="canonical" href="https://example.com/pricing">
Pro tip: Strip tracking parameters (utm_*, gclid, fbclid) when you build the canonical. Parameter variants then consolidate too.
6

Fix internal links and the XML sitemap

Update menus, footers, breadcrumbs, in-content links and hreflang tags so they use the exact canonical form. xml so it lists only canonical URLs. Redirects are a safety net.

Linking straight to the final URL avoids extra hops and gives search engines a consistent signal.

Pro tip: Search your database or theme files for href="/index.html" and for uppercase slugs. These are the most common leftovers.
7

Test every variant and recrawl

Request each variant with curl. Each one should return a single 301 straight to the canonical URL, and the canonical URL should return 200 with a matching canonical tag. Then rerun the audit or a full crawl and confirm no duplicate groups remain.

text
curl -sI https://example.com/Pricing/ | grep -iE '^(HTTP|location)'
curl -sI https://example.com/pricing/index.html | grep -iE '^(HTTP|location)'
curl -s https://example.com/pricing | grep -i 'rel="canonical"'

Platform-specific notes

WordPress

Settings > Permalinks controls the trailing slash: a structure ending in / adds it, one without removes it. The built-in redirect_canonical() handles most slash variants. Yoast SEO and Rank Math output canonical tags automatically; under Advanced on each post, check that no custom canonical was set to a wrong-case URL. Uppercase URLs usually still resolve, so add a lowercase rule with the Redirection plugin (regex) or in .htaccess.

Shopify

Shopify forces lowercase handles and removes trailing slashes. Most duplicates there come from collection-scoped product URLs such as /collections/x/products/y. Make sure theme.liquid still contains <link rel="canonical" href="{{ canonical_url }}">, and in product grids link to {{ product.url }} rather than {{ product.url | within: collection }}.

Next.js

Set trailingSlash: true or false in next.config.js; Next.js then 308-redirects the other form. For lowercase, add middleware that checks whether pathname !== pathname.toLowerCase() and returns NextResponse.redirect with status 301. Set canonicals with the metadata API: alternates: { canonical: 'https://example.com/pricing' }.

Cloudflare

Go to Rules > Redirect Rules and create a dynamic redirect. Match with the expression: http.request.uri.path ne lower(http.request.uri.path). Use this target expression: concat("https://example.com", lower(http.request.uri.path)), with status 301 and query string preserved. This lowercases URLs at the edge for servers like Nginx that cannot do it natively.

Webflow

Webflow lowercases slugs and serves URLs without a trailing slash. Under Site settings > SEO > Global canonical tag URL, enter https://example.com so every page gets a self-canonical. Add any legacy /Page or /index.html paths under Site settings > Publishing > 301 redirects.

Check that it worked

✅ How to verify

  • curl -I on the uppercase, trailing-slash and /index.html variants returns one 301 or 308 whose Location is the canonical URL.
  • The canonical URL returns 200, and its <link rel="canonical"> exactly matches the URL in the address bar.
  • A fresh crawl shows no URL pairs that differ only by case, a trailing slash or an index file name, and the audit check passes.
  • In Google Search Console, URL Inspection on a former variant shows 'Page with redirect', and the Google-selected canonical matches yours.

⚠️ Common mistakes

  • Generating the canonical from the requested URL. Every variant then self-canonicalises and stays a duplicate.
  • Mixing rules that cause redirect chains or loops, e.g. a lowercase redirect followed by a slash redirect followed by an https redirect, instead of one hop.
  • Using 302 redirects or a JavaScript redirect, which do not consolidate signals reliably.
  • Fixing redirects but leaving internal links, hreflang tags and the sitemap pointing at the old variants.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

Should my URLs have a trailing slash or not?

Either works for SEO. What matters is consistency: pick one, redirect the other form with a 301, and use it in canonicals, links and the sitemap. Keep whatever most of your indexed pages already use.

Are URLs case-sensitive for Google?

Yes. Google treats /Page and /page as different URLs. Windows/IIS servers and many CMSs serve both, which creates duplicates. Redirect to lowercase or canonicalise to it.

Is a canonical tag enough, or do I need redirects?

A canonical tag pointing to the preferred URL resolves the duplication signal, but Google treats it as a hint. A 301 redirect is stronger and also fixes what users see and bookmark. Use redirects where you can and canonicals everywhere.

Will redirecting URL variants hurt my rankings?

No. Consolidating duplicates with 301s merges link equity into one URL and usually stabilises rankings. You may see brief fluctuation for a few weeks while Google recrawls.