Remap Rules cheat sheet

The Remap Rules functionality fundamentally uses the PHP preg_replace() function, whose usage is described here:

http://php.net/manual/en/function.preg-replace.php

So essentially, “Remap From” is $pattern, “Remap To” is $replacement, and the URL is $subject when reading the PHP documentation.

Also note that for the purposes of remap rules the URL is without the leading http:// or https:// - remap rules always preserve the original protocol, you can’t modify it.

At any rate, I think what you want is something like this:

Remap From: |.*/graduate-program/.*|i
Remap To:   mysitehere.com.au/graduateprogram

The regular expression pattern breaks down as follows:

  • The | characters are the regular expression delimiters (usually / is used for this, but in this case you want to match against / characters so it’s less messy to use something else).
  • The i at the end is for case-insensitive matching (assuming that’s what you want - i.e. it’ll catch /Graduate-Program/ as well as /graduate-program/)
  • The two occurrences of .* match anything before and after /graduate-program/. This is necessary because otherwise it’ll only replace the /graduate-program/ part of the URL, instead of changing the entire URL.
4 Likes