Canonical for Filters
How to use canonical URLs to prevent indexing of unpopular filter combinations in e‑commerce and directory sites.
Canonical for filters is a strategy for managing duplicate content on filtered listing pages. Popular combinations (that have search demand) use a self‑referencing canonical; unpopular ones use a canonical pointing to the parent category page. This saves crawl budget and avoids duplicate content penalties.
What Is Canonical for Filters
In e‑commerce sites and directories, filters generate a huge number of URLs with identical or partially changed content. For example, the 'Shoes' category can have filters for brand, size, colour, price. Parameter combinations can create hundreds of thousands of page variants. The problem: search bots waste crawl budget on all these duplicates, and users rarely visit unpopular combinations. The solution is to dynamically set the canonical based on demand for the combination.
Decision Strategy
Divide all filter combinations into three categories:
- High demand — combinations that see regular search queries (e.g., 'Nike sneakers'). Set a self‑referencing canonical.
- Medium demand — combinations that are sometimes searched but not often. Can keep self‑canonical but monitor crawl budget.
- Low or zero demand — combinations no one searches for. Set canonical to the parent category (no filters).
Example decision table for the /shoes/ category:
URL Demand Canonical
/shoes/ High self
/shoes/?brand=nike High self
/shoes/?brand=nike&color=red Medium self
/shoes/?brand=nike&color=red&size=42 Low /shoes/
/shoes/?brand=nike&color=red&size=42&sort=price_asc Low /shoes/Technical Implementation
You need to determine on the server whether the current filter combination is popular. The simplest way is to maintain a whitelist of combinations in code or a database.
<?php
// Example PHP logic
$popularCombinations = [
'brand=nike',
'brand=adidas',
'color=black',
'brand=nike&color=black'
];
$currentFilters = http_build_query($_GET); // 'brand=nike&color=red&size=42'
if (in_array($currentFilters, $popularCombinations)) {
$canonical = 'https://example.com/shoes/?' . $currentFilters;
} else {
$canonical = 'https://example.com/shoes/';
}
?>
<link rel="canonical" href="<?= htmlspecialchars($canonical) ?>" />A more advanced approach is to use data from Google Search Console and Analytics. Combinations that bring clicks and impressions keep a self‑canonical; the rest go to the category page.
Alternative Approaches
- JavaScript filters without URL changes — filtering happens client‑side, URL stays the same. No duplicate problem, but you can’t index popular combinations as separate pages.
- noindex for unpopular combinations — block indexing via meta robots. Downside: loss of link equity.
- nofollow on filter links — instruct bots not to follow links to unpopular combinations (using rel="nofollow"). Not always effective, as bots may still discover them.
Common questions
Discuss your project?
Share your goals and website context — I will suggest a practical next step.