Rewriting URLs can be really useful if you need to point your new build to a specific environment i.e. point Prod build at non-Prod env. At a previous company I used this feature to redirect traffic from our Android Test build to our Prod environment.
This tutorial will show you how to use the Rewrite feature to redirect traffic from one website to another. In this example we will redirect users from the NY Times website to BBC News website.
You can also achieve a similar result with the Map Remote feature.
Go to the NY Times website
Open Chrome and go to https://www.nytimes.com/
Enable SSL Proxying
Return to Charles. Right click the NY Times request and click the “Enable SSL Proxying” option
The Request(s) you want to modify must be decrypted before you can use the Rewrite feature with it
Reload the page on Chrome
Return to Charles. You should now see traffic for http://www.nytimes.com in plain text
Open Rewrite screen
Tools -> Rewrite -> on the Rewrite Settings screen, tick the “Enable Rewrite” checkbox
Configure a Rewrite Location
Add -> Click Add (from the ‘Location’ section) -> Paste https://www.nytimes.com into the “Host” field -> press the “tab” on your keyboard (this will auto populate most of the fields) -> set the “Port” to 443
Setup the Rewrite Rule
Click Add (the centre bottom Add button) to open the Rewrite Rule screen. Configure as follows:
Reload NYTimes page in Chrome
You should now be redirected to the BBC News site instead
See article about common problems when working with Rewrite rules