Rewrite – Redirect URL

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

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 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 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:

  • Select “URL” from the “Type” dropdown
  • Paste into the “Value” textfield of the Match section
  • Paste into the “Value” textfield of the Match section
  • Click OK to save the Rewrite Rule
  • Click OK to close the Rewrite Settings screen

Reload NYTimes page in Chrome

You should now be redirected to the BBC News site instead

Having problems?

See article about common problems when working with Rewrite rules

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: