Regex based redirections – Set redirect rules targeting the referring URL & the landing page URL

Feb 6th, 2012 by No Comments


In this release we’ve added the ability to use special regular expression rules to define who we redirect and where we redirect them to.

We can set a rule up that redirects ONLY IF the visitor arrives from a website containing certain strings or permalink structures in their referring URL.

We can also further limit the redirection by redirecting ONLY IF the visitor is landing on a page who’s permalink contains a certain strings or a certain permalink structure.

Additionally we can “lift” parts of each URL, both the landing page and the referring URL, and append them onto our redirect URL.

Here’s a video case study of this new regular expression rule based redirection system:

In what way should we use this system?


Set the referrer condition to /(.*?)/ to make sure we don’t care where the traffic is coming from. The set the landing page condition to /category-or-tag-name/ to redirect all traffic containing these keywords in their permalink structure.


I developed this system for a friend who wanted to use it in this way: He wanted to send traffic from one of his junk blogs (Site A) to a webpage that auto-generated Amazon advertisements with related content (Site B), while once again immediately redirecting the traffic to Amazon with related keywords attached so as to generate an Amazon product search page (Site C). He also wanted Site C (Amazon) to think the traffic was coming from Site B rather than Site A. This system was built to accommodate this need which will allow him to funnel traffic from low quality sources and mitigate the risk of his account being terminated.


Another way is to setup rules to redirect all traffic arriving from an old domain to it’s proper location on a new domain. This use would be similiar to something we would normally use the popular (free) Redirection plugin . Note: The free Redirection Plugin uses Mod Rewrite’s regular expression rules to execute their redirects by adding rules to the .htaccess file, I believe.

Another application would be to redirect all incoming traffic arriving on a certain blog category to the homepage.

Those are just the few applications I can imagine off the top of my head. This system uses PHP’s regular expression engine and will allow for many different kinds of yet unimagined applications.

I hope you like it!

Screenshot of regex based redirection profile:

regulare expression rule based redirection profile



Leave a Reply