# SEO - Pretty Filters

> Clean, indexable URLs for Magento layered navigation — Hyvä and ElasticSuite compatible. Turns query-string facets into real, crawlable category paths.

<Admonition type="warning" title="Important">
qoliber SEO Pretty Filters is a stand-alone commercial product, currently available to qoliber extensions licensees only.
</Admonition>

## Overview

This groundbreaking extension introduces SEO-friendly URLs for any filter (layered navigation) rendered on product listing pages (PLPs). It is the **first of its kind** to offer full compatibility with **Hyvä** and **ElasticSuite**, making it an unparalleled solution for modern Magento, MageOS and Adobe Commerce stores.

## The Problem

Out of the box, Magento, MageOS and Adobe Commerce generate non-SEO-friendly URLs that look like this:

```
https://demo.store.com/women/bottoms-women.html?eco_collection=1&material=147&size=172&style_bottom=104
```

Numeric IDs from the database are tied to attribute values, making it impossible for merchants to craft user-friendly, SEO-optimised URLs. For example:

- `147` corresponds to the **LumaTech™** material attribute.
- `104` corresponds to the **Base Layer** style attribute.
- … and so on.

This lack of flexibility blocks marketing teams from using filter URLs in campaigns, paid ads and content links — and it leaves every faceted page unindexable for what customers actually search for.

## The Solution

The Qoliber SEO Pretty Filters extension solves this by rewriting filter URLs into clean, human-readable form. The same page becomes:

```
https://demo.store.com/women/bottoms-women/29-base-layer-lumatech-trade.html
```

or, in the explicit attribute-coded variant:

```
https://demo.store.com/women/bottoms-women/style_bottom:base-layer/material:lumatech-trade.html
```

## What Does This Extension Do?

- **Three URL generation modes** — pick the one that fits your catalogue:
  - **Short** — `[category]/value1-value2.html`. Cleanest URLs; requires globally-unique attribute values.
  - **Complex** — `[category]/color:red/size:large.html`. Includes attribute codes; safe on large stores with overlapping value names.
  - **Flat** — `[category]/red--large--quartz.html`. Comma-separated values with a configurable segment separator (`--` or `__`) and customisable attribute order.
- **Per-store configuration** — different modes and separators per store view if needed.
- **Hyvä compatibility** — works alongside the Hyvä theme without custom theme overrides.
- **ElasticSuite compatibility** — pairs with the optional `SeoPrettyFiltersElasticSuite` add-on for ElasticSearch-powered layered navigation.
- **Swatches integration** — colour and image swatches emit clickable links to the SEO-friendly URLs.
- **Canonical URL hygiene** — filtered pages emit a canonical pointing to the clean (unfiltered) category, so ranking signal isn't fragmented across thousands of facet permutations.
- **Dynamic robots directive** — optionally apply `noindex` (or a custom directive) to filter combinations above a configurable count, the standard tactic for taming faceted-nav crawl budget.

## Why Is This Revolutionary?

- **First of its kind** — the only Magento extension shipping clean filter URLs that work with both Hyvä and ElasticSuite.
- **Top-quality code** — built to PSR-12 and PHPStan level-8, with hundreds of integration tests locking the contract.
- **Marketing-team-ready** — clean filter URLs become viable as ad landing pages, email-campaign links and sitemap entries.
- **Crawl-budget-aware** — canonical hygiene and configurable `noindex` keep Google focused on URLs that actually deserve to rank.

## How Does It Work?

A request matcher catches incoming URLs, parses the SEO-friendly path against the configured mode, and resolves it back to the equivalent attribute-filter parameters Magento expects. Forward generation (rendering filter links on the storefront) goes through the same engine in reverse — every link emitted on a category page already speaks the SEO-friendly format.

### Configuration at a glance

Find the module under **Stores → Configuration → Qoliber → SEO: Pretty Filters**. Pick your URL mode, set the separator (for Flat mode), and configure the canonical/robots policy.

## Screenshots

![Pretty Filters Configuration](https://docs.qoliber.com/images/extensions/seo-pretty-filters/img4.png)

![Pretty Filters URL Example](https://docs.qoliber.com/images/extensions/seo-pretty-filters/img5.png)

## Companion Module: SeoPrettyFiltersElasticSuite

If your store runs **Smile ElasticSuite**, install `qoliber/seo-pretty-filters-elasticsuite` alongside this module. It provides ElasticSuite-specific implementations of all three URL modes so faceted search powered by ElasticSearch produces the same clean URLs.

## What's New in 2.1

- **Critical reflected-XSS fix** in `RequestParamsProvider` — parameter values now `rawurlencode()`-d before URL building.
- **Canonical URL cleanup** — UTM tags, sortby and other unresolvable params no longer leak into the canonical link; search-result canonicals preserve the normalised `q` parameter.
- **Stateless `RequestPathResolver`** — removed a per-instance cache that could leak across requests in long-running PHP processes (FPM, Octane).
- **Router early-exit optimisation** — bails immediately for known non-catalog prefixes (`admin`, `rest`, `graphql`, `static`, `media`, `checkout`) before invoking the resolver chain. Measurable per-request latency win on every page that isn't a category.
