Forward Rewrite regular expression example

Here's how you can set up a regex rule for forwarding both HTTP and HTTPS traffic from the same inbound URL to a different outbound URL:

In this case, the Regular Expression value is (?:http|https)://(?:[A-z0-9|\.]*)/(.*) and the Path and Query String value, with substitution pattern, is /\1&extra_param=bar.

Note: For Forward Rewrite, you can only use substitution patterns on the URL path. If you want to change the protocol or host, you need to use Conditional Origins.

When this rule is activated, all requests to http://www.example.com/path1/path2/home.html?query=foo would retrieve content from http://www.neworigin.com/path1/path2/home.html?query=foo&extra_param=bar without changing the URL.

Note: If your regular expression includes any characters that have a special use in regular expressions (like “.”, “+”, or “?”), you must use a backslash (“\”) to escape each special character.