How to change a part in the URL (e.g. domain) while keeping the rest of the URL same?

Requestly’s Replace String rule allows users to replace a string (or matching pattern) with another string in the url. It looks to be very simple but it can achieve very complex use cases:

  • Switching Domains
  • Change Query Parameter Values
  • Fix broken/updated URLs
  • Pattern Matching in Replace Rule

Using Requestly to change the domain of the URL

In this example we will change the domain of the url with stackoverflow.

  1. Download and Install the Requestly Chrome extension.
  2. Click on Create your first rule.
  3. Then select Replace String and click on Create rule.
  4. We’ll be replacing the substring exchange with overflow . Enter exchange in the Replace field and overflow in the With field.
  5. Save the rule.

On opening, this rule will replace the exchange substring with overflow and will load the webpage for

You can try it yourself by importing this rule , also fiddle around and replace different substrings of the URL.

This article was written by:

Sagar Soni

Sagar Soni

Sagar, the co-founder and CTO of Requestly, has been pivotal in shaping the company's vision and product trajectory. With over a decade of professional experience, he has been affiliated with renowned companies like Google, Adobe, and Grofers.

Share this article:

You may also like