WordPress.org

Ready to get started?Download WordPress

Forums

URL Redirection help (2 posts)

  1. webscraper
    Member
    Posted 1 year ago #

    I am making little plugin which just redirect one URL to another. My code is as given below

    add_action("init","redirect");
    
    function redirect()
    {
    add_rewrite_rule('^/this_is_url/$','another_url','top');
    flush_rewrite_rules();
    }

    I don't know why this code is not working. Is there anything missing? Thanks.

  2. webscraper
    Member
    Posted 1 year ago #

    I have added below line as well to run plugin code when it activated.

    register_activation_hook(__FILE__,'redirect');

    But redirection still not working.

Topic Closed

This topic has been closed to new replies.

About this Topic