Skip to content

Query Strings in Redirects

Control the behavior around query strings in your Redirects using the Match Definition and Query String Strategy settings. Below we'll take a look at examples of how these settings can be used.

Match Definition

The Match Definition setting determines how to match 404 requests with Redirect records already captured in the database. Once the incoming Request URL is received, depending on this setting, the query string value may be retained or removed before searching the database for a matching value.

URL (with query strings) Example

Request URLwww.website.com/blog?p=123
Old URL Search Valueblog?p=123
Old URL Matchblog?p=123

URL (without query strings) Example

Request URLwww.website.com/blog?p=123
Old URL Search Valueblog
Old URL Matchblog

Query String Strategy

The Query String Strategy setting determines how to treat query strings after processing a redirect.

Remove Query Strings Example

Request URLwww.website.com/blog?p=123
New URL Matchblog/slug-name
New URL Redirect Locationblog/slug-name

Append Query Strings Example

Request URLwww.website.com/blog?p=123
New URL Matchblog/slug-name
New URL Redirect Locationblog/slug-name?p=123

Combining Strategies

Together the Match Definition and Query String Strategy settings allow redirects to be configured in several ways

URL (with query strings) + Remove Query Strings

Request URLwww.website.com/blog?p=123
Old URL Search Valueblog?p=123
Old URL Matchblog?p=123
New URL Matchblog/slug-name
New URL Redirect Locationblog/slug-name

URL (with query strings) + Append Query Strings

Request URLwww.website.com/blog?p=123
Old URL Search Valueblog?p=123
Old URL Matchblog?p=123
New URL Matchblog/slug-name
New URL Redirect Locationblog/slug-name?p=123

URL (without query strings) + Remove Query Strings

Request URLwww.website.com/blog?p=123
Old URL Search Valueblog
Old URL Matchblog
New URL Matchblog/slug-name
New URL Redirect Locationblog/slug-name

URL (without query strings) + Append Query Strings

Request URLwww.website.com/blog?p=123
Old URL Search Valueblog
Old URL Matchblog
New URL Matchblog/slug-name
New URL Redirect Locationblog/slug-name?p=123

Craft The Planet