How to change a part in the URL (e.g. domain) while keeping the rest of the URL same?
Sagar Soni
February 17, 2025
Learn how to easily change parts of a URL, like the domain, while keeping the rest the same. Use Requestly to simplify URL manipulation. Read now!

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 https://stackexchange.com with stackoverflow.
- Download and Install the Requestly Chrome extension.
- Click on
Create your first rule. - Then select
Replace Stringand click onCreate rule. - We’ll be replacing the substring
exchangewithoverflow. Enterexchangein the Replace field andoverflowin the With field. - Save the rule.

On opening stackexchange.com, this rule will replace the exchange substring with overflow and will load the webpage for stackoverflow.com.
You can try it yourself by importing this rule , also fiddle around and replace different substrings of the URL.
Written by
Sagar Soni
Sagar is the co-founder and CTO of Requestly (recently acquired by BrowserStack). With over 8 years of experience in software development and entrepreneurship, he’s passionate about building innovative tools that solve real-world problems. From architecting scalable web applications to leading cross-functional teams, Sagar has worn many hats throughout his journey from technical implementation to business strategy. Always looking for the next challenge to tackle.
Contents
Subscribe for latest updates
Share this article
Related posts

Endpoint ft. Kushagra Gour: A Builder’s Philosophy on Craft and Empathy
In the world of technology, some leaders don’t just follow trends—they define them. They are the builders and thinkers, grounded in real-world experience, whose insights push the industry forward. To celebrate their work and bring their hard-won wisdom to the community, we’re proud to introduce Endpoint—a series by Requestly spotlighting the leaders shaping the future of software.
Kanishk Rawat
November 3, 2025

1xx HTTP Status Codes: Informational Responses
Explore 1xx informational HTTP status codes and their role in communicating request progress between client and server.

Azma Banu
November 3, 2025

Mock APIs with Pagination: Types, Steps, and Best Practices
Learn how to mock APIs with pagination in a step-by-step guide that covers setup, pagination formats, and structured methods for effective API simulation.

Rohit Rajpal
October 31, 2025






