---
title: querystring.set
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/query-string/querystring-set
---

```
STRING querystring.set(STRING url, STRING name, STRING value)
```

**Available in:** all subroutines

Returns the given URL with the given parameter `name` set to the given `value`,
replacing the original value and removing any duplicates. If the parameter
is not present in the query string, the parameter will be appended with
the given value to the end of the query string. The parameter `name` and `value`
will be URL-encoded when set in the query string.

## Example

```vcl
set req.url = querystring.set(req.url, "foo", "baz");
```
