Multiple endpoints to same page

I’m doing a bit of AB testing, and am looking for a way to point multiple endpoints to the same page in wordpress. My site is using wordpress as it’s CMS tool.

http://mysite.com/test/link1
http://mysite.com/test/link2
http://mysite.com/test/link3

I want the above URL’s to point to the about page generated through wordpress

http://mysite.com/about

The specific use case is to track hits through google analytics. I’ve tried doing 301 redirects, but searching through referrers for your site doesn’t always work. Any idea’s?

1
1

Okay… here’s how you add the rule.

<?php
    add_action('init', 'add_my_rule');

    function add_my_rule()
    {
        add_rewrite_rule('^test\/link.*$','index.php?pagename=about','top');
    }
?>

This rule will ensure that when you visit a url like http://.../test/link or http://.../test/link<xyz>, you are redirected to the about page (please make sure the slug for about page is ‘about’). Also, http://.../test/, will take you the test page and not the about page.

Let me know if this works for you.

Leave a Comment