Using Query Parameters With Redirects

When you set up a redirect in All in One SEO, you have some options on how to handle URL query parameters.

This is a hugely beneficial feature for anyone that uses URL query parameters to track how a visitor gets to your content.

What is a Query Parameter

A URL query parameter is a string that is appended to a URL like this:

  • Example URL without query parameter: https://aioseo.com/docs/using-query-parameters-with-redirects/
  • Example URL with query parameter: https://aioseo.com/docs/using-query-parameters-with-redirects/?source=aioseo_blog

In the examples above, the query parameter could be used for links to this article from the AIOSEO Blog. Then you can track this in Google Analytics or other analytics tools so you know how successful that link is and how many times it's clicked on.

With the Redirection Manager in All in One SEO, you can choose how you redirect both URLs above (the one with and without the query parameter).

Query Parameter Settings for a Single Redirect

To use this feature, go to Redirects in the All in One SEO menu.

Redirects menu item shown in the All in One SEO menu

You'll see the Add New Redirect form.

Add New Redirect form in the Redirection Manager in All in One SEO

In the Source URL field, enter the URL you want to redirect from. The URL must be a relative URL, i.e. don't include the https://mydomain.com part of your URL.

Source URL field in the Add New Redirection form

In the Target URL field, enter the URL you want to redirect to. The URL can be either a relative URL or an absolute URL.

Target URL field in the Add New Redirection form

You can also start typing the title of any post, page or other content on your site, or the slug or ID in the Target URL field and the matching content will be displayed. Click on the post or page you want to select as your target.

Now click on the Advanced Settings toggle, to display the Query Parameters drop down.

Query Parameters drop down in the Add New Redirection form

You'll see four choices as follows:

  • Ignore all parameters: If you select this, then any URL query parameters will be ignored and the source URL will redirect to the target URL
  • Exact match all parameters in any order: If you select this, then the redirect will match any URL query parameters you specify in the Source URL field. The plugin will ignore the order if you have multiple parameters
  • Ignore & pass parameters to the target: If you select this, then any URL query parameters will be ignored but will be passed to the target URL so that they're preserved
  • Ignore all parameters except UTM: If you select this, then any URL query parameters will be ignored except for any UTM query parameters.

Query Parameter Settings for all Redirects

If you want to set the default for Query Parameters for all redirects, then start by going to Redirects in the All in One SEO menu and then click on the Settings tab.

Settings tab shown on the Redirects screens

Scroll down until you see the Redirect Defaults section and you'll see a setting for Query Parameters.

Query Parameters setting in Redirects Settings

You'll see the same drop down with the same four options as described above. Whatever you set here will apply to all new redirects you create.

Check out more documentation on our Redirection Manager here.