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 String
and click onCreate rule
. - We’ll be replacing the substring
exchange
withoverflow
. Enterexchange
in the Replace field andoverflow
in 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. When he’s not busy architecting the next big thing in software development, you’ll likely find him behind the wheel, cruising the streets and enjoying the thrill of the drive. For Sagar, it’s all about the code by day and the open road by night.
Contents
Subscribe for latest updates
Share this article
Related posts

Organized 125k APIs and improved productivity by 20% using the Requestly API Client: Cyrisma
Cyrisma improved API management with Requestly’s API client, boosting security, reducing errors, and accelerating development. Learn how they did it
Dinesh Thakur
February 19, 2025
How to Test FastAPI Efficiently with Requestly API Client
Learn how to test FastAPI APIs with Requestly API Client for easy debugging, request modifications, and automation. Take control over your API testing workflow!
Dinesh Thakur
February 13, 2025

How to Export Postman Collection
Learn how to export a Postman collection easily and save it as a JSON file for backup or sharing.
Kanishk Rawat
February 13, 2025