---
title: How do I perform Vercel redirects based on query strings?
description: When using redirects with the `vercel.json` or `next.config.js` configuration file, your URL may contain query parameters that you would like to use in your re-direction, this is possible with 2 different methods.
url: /kb/guide/how-do-i-perform-vercel-redirects-based-on-query-strings
canonical_url: "https://vercel.com/kb/guide/how-do-i-perform-vercel-redirects-based-on-query-strings"
published: 2025-11-03
last_updated: 2025-11-10
authors: Ismael Rumzan
related:
  - /docs/configuration
  - /docs/project-configuration
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---
<!-- docsgraph:related -->
## Related pages

> **For AI agents:** Follow these links to understand how this page connects to the rest of the Vercel ecosystem. For the full cross-link map (inbound, outbound, prerequisites, and semantic neighbors), see the .graph.md link below.

- [Configuration Redirects](https://vercel.com/docs/routing/redirects/configuration-redirects?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related) — Learn how to define static redirects in your framework configuration or vercel.json with support for wildcards, pattern
- [Redirects](https://vercel.com/docs/routing/redirects?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related) — Learn how to use redirects on Vercel to instruct Vercel's platform to redirect incoming requests to a new URL.
- [Redirecting Domains](https://vercel.com/blog/redirecting-domains?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related)
- [Managing redirects at scale](https://vercel.com/docs/routing/redirects/manage-redirects-at-scale?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related) — Add, bulk upload, version, and roll back project-level redirects using the CLI.
- [vercel redirects](https://vercel.com/docs/cli/redirects?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related) — Learn how to manage project-level redirects using the vercel redirects CLI command.
- [Routing based on Headers and Query String Parameters](https://vercel.com/changelog/routing-based-on-headers-and-query-string-parameters?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related)
- [Bulk Redirects](https://vercel.com/docs/routing/redirects/bulk-redirects?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related) — Learn how to import thousands of simple redirects from CSV, JSON, or JSONL files.
- [Does Vercel support permanent redirects?](https://vercel.com/kb/guide/does-vercel-support-permanent-redirects?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related) — Information on Vercel's support for permanent redirects.
- [Can I redirect from a subdomain to a subpath?](https://vercel.com/kb/guide/can-i-redirect-from-a-subdomain-to-a-subpath?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related) — Learn how to redirect from your subdomain to a subpath on Vercel with a vercel.json file or with Next.js
- [How can I increase the limit of redirects or use dynamic redirects on Vercel?](https://vercel.com/kb/guide/how-can-i-increase-the-limit-of-redirects-or-use-dynamic-redirects-on-vercel?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related) — Instructions on how to use Serverless Functions to handle redirects on Vercel.
- [Can I use Vercel as a reverse proxy?](https://vercel.com/kb/guide/vercel-reverse-proxy-rewrites-external?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related) — Learn how to use rewrites to proxy requests from Vercel to other deployments.
- [Dynamic redirects with Global Config and Next.js proxy](https://vercel.com/kb/guide/dynamic-redirects-with-global-config-and-next-js-proxy?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=related) — Learn how to create redirects that update instantly without redeploying by storing rules in Global Config and reading th

Full cross-link map for this page: [/kb/guide/how-do-i-perform-vercel-redirects-based-on-query-strings.graph.md](/kb/guide/how-do-i-perform-vercel-redirects-based-on-query-strings.graph.md?from=related&source_path=%2Fkb%2Fguide%2Fhow-do-i-perform-vercel-redirects-based-on-query-strings&source_site=vercel-kb&relationship=graph)
<!-- /docsgraph:related -->


When using redirects with the [`vercel.json`](https://vercel.com/docs/configuration#project/redirects) or [`next.config.js`](https://nextjs.org/docs/api-reference/next.config.js/redirects) configuration file, your **URL** may contain query string parameters that you would like to use in your redirection. This article explains the two methods possible to achieve this.

## Include query strings in redirect destination

By default, all query strings that are found in the **source** path will be passed to the **destination** path. In the example configuration below, if the source is `/?baz=10`, the destination will be `/lol/?path=foo&baz=10`.

```json
{
   "redirects":[
      {
         "source":"/",
         "destination":"/lol/?path=foo"
      }
   ]
}
```

## Redirect based on value of query string

Using the `has` property, you can redirect to a specific route based on the value of the query parameter being present. For example, in the configuration below, if the source is `/specific/mypath?page=home&id=1000`, it will be redirected to `/another/mypath?page=home&id=1000`.

```json
{
  "redirects": [
    {
      "source": "/specific/:path*",
      "has": [
        {
          "type": "query",
          "key": "page",
          "value": "home"
        }
      ],
      "permanent": false,
      "destination": "/another/:path*"
    }
  ]
}
```

For details related to using the `has` field, review this [page](https://nextjs.org/docs/api-reference/next.config.js/redirects#header-cookie-and-query-matching) for `next.config.js` and this [page](https://vercel.com/docs/project-configuration#project-configuration/redirects) for `vercel.json`.