> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-web/en/autify-university/foundation/test-plans/url-replacements.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# URL Replacements

## What are URL replacements?

Do you use several environments when making changes to your corporate website? These environments can go by many names: staging, dev, production, etc. Typically, each environment has a different URL, but the websites tested are the same.

With Autify's URL replacement feature, you won't have to create a new scenario for each URL. Simply replace the relevant URLs in the scenario and start running tests.

## How to set up URL replacements

Open the Test Plan Details Page. Under **\[URL Replacements]**, click **\[Add]**.

![](https://1964297753-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVdZPTgwISYb3LhjgKnw6%2Fuploads%2Fgit-blob-99844b59620cc256e6bd0c0bf22d4e7fd2015e12%2FURL_replacement_2_en.png?alt=media)

Specify **\[URL to be replaced]** and **\[URL after replacement]**, and click **\[Create]**.

![](https://1964297753-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVdZPTgwISYb3LhjgKnw6%2Fuploads%2Fgit-blob-2adb8aa389f7808f862b45295b301ea09b6d7ea9%2FURL_replacement_3_en.png?alt=media)

You can also replace multiple URLs:

![](https://1964297753-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVdZPTgwISYb3LhjgKnw6%2Fuploads%2Fgit-blob-adbd5248073d6a819d6ca24efec13a49436dac36%2FURL_replacement_1_en.png?alt=media)

All URLs within the scenario that exactly match **\[URL to be replaced]** will be replaced with **\[URL after replacement]**.

## URL to be replaced

When you execute a test plan, the following URLs will be replaced from \[URL to be replaced] with the URL you specified in the \[URL after replacement].

* The start URL in the first step.
* The URL of [Go-To Steps](https://help.autify.com/nocode-web/en/autify-university/foundation/creating-a-scenario/go-to-url-button.md).
* URLs contained in the input values of input steps, etc.
* The URL of "URL Should Be/Contain" assertion steps.
* The URL in [page element assertions](https://help.autify.com/nocode-web/en/autify-university/advanced/assertions-1/assertion-elements-on-the-page.md).
* The URL in [JS Steps](https://help.autify.com/nocode-web/en/autify-university/advanced/js-steps/javascript-steps.md).

  * If the URL is dynamically created within the JS step, it will not be replaced.

  ```js
  // subject to replacement
  return "https://autify.com"
  ```

  ```js
  // not subject to replacement
  return "https://" + "autify.com"
  ```
* The URL in steps within Step Groups. (If the URL within a Step Group is overwritten with \[URL to be replaced], it will be replaced with the URL specified in \[URL after replacement] before execution.)
* The URL in [JavaScript snippets](https://help.autify.com/nocode-web/en/autify-university/advanced/js-steps/reusable-js-steps.md).
* The URL in [Data](https://help.autify.com/nocode-web/en/autify-university/foundation/creating-a-scenario/creating-data.md)

## URL not to be replaced

The following URLs will not to be replaced:

* URLs set in [Variables](https://help.autify.com/nocode-web/en/autify-university/advanced/variables.md)

## Examples

Here are three examples of how URLs in scenarios are replaced. In this example, we assume that there are two URLs we want to replace. We will call them Replacement 1 and Replacement 2.

In Case 1, the URL in the scenario is an exact match with \[URL to be replaced], so it's replaced with the URL specified in \[URL after replacement].

URLs are replaced starting from the longest \[URL to be replaced]. Therefore, in Case 2, Replacement 2 is applied instead of Replacement 1.

In Case 3, Replacement 1 is applied - the front part of the URL is replaced.

|               | URL to be replaced                  | URL after replacement                 |
| ------------- | ----------------------------------- | ------------------------------------- |
| Replacement 1 | https\://`dev`.example.com          | https\://`prd`.example.com            |
| Replacement 2 | https\://`dev`.example.com/project1 | https\://`prd`.example.com/project`A` |

|        | URL in the scenario                 | URL after replacement                 | Replacement   |
| ------ | ----------------------------------- | ------------------------------------- | ------------- |
| Case 1 | https\://`dev`.example.com          | https\://`prd`.example.com            | Replacement 1 |
| Case 2 | https\://`dev`.example.com/project1 | https\://`prd`.example.com/project`A` | Replacement 2 |
| Case 3 | https\://`dev`.example.com/home     | https\://`prd`.example.com/home       | Replacement 1 |

**Note:** If you plan to use the URL replacement feature to create test plans for different execution environments, we recommend that you name your scenario with URL replacement in mind.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.autify.com/nocode-web/en/autify-university/foundation/test-plans/url-replacements.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
