Multiple endpoints to same page

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