vip_regex_redirects

Advanced 301 redirects using regex to match and redirect URLs.

Warning: Since regex is expensive and this will be run on every uncached pageload, you’ll want to keep this small, lean, and mean.

Some examples:

Redirecting from /2011/12/dont-miss-it-make-live-holiday-giveaway.html (extra .html at the end) ‘|/([0-9]{4})/([0-9]{2})/([0-9]{2})/([^/]+).html|’ => ‘|/$1/$2/$3/$4/|’

Redirecting from /archive/2011/12/dont-miss-it-make-live-holiday-giveaway ‘|/archive/([0-9]{4})/([0-9]{2})/([^/]+)/?|’ => ‘|/$3/|’ // since we don’t have the day, we should just send to /%postname% then WordPress can redirect from there

Redirecting from /tax-tips/how-to-get-a-tax-break-for-summer-child-care/04152011-6163 (/%category%/%postname%/%month%%day%%year%-%post_id%) ‘|/([^/]+)/([^/]+)/([0-9]{1,2})([0-9]{1,2})([0-9]{4})-([0-9]{1,})/?|’ => ‘|/$5/$3/$4/$2/|’

Parameters

Name Type Description
$vip_redirects_array array Optional. Array of key/value pairs to redirect from/to.
$with_querystring bool Optional. Set this to true if your redirect string is in the format of an absolute URL. Defaults to false (just the path).

Return Value

void

Ready to get started?

Tell us about your needs

Let us lead the way. We’ll help you select a top tier development partner. We’ll train your developers, operations, infrastructure, and editorial teams. We’ll coarchitect your deployment processes. We will provide live support for peak events. We’ll help your people avoid dark alleys and blind corners, and reduce wasted cycles.