WordPress.org

Ready to get started?Download WordPress

Forums

Simple 301 Redirects
Ignore Get Parameters (4 posts)

  1. fr33think3r
    Member
    Posted 3 years ago #

    The redirect function should ignore the Get Parameters. Right now it doesn't, so URLs which have get parameters like the google analytics parameters - utm_source, utm_target, don't get redirected

    I added a couple lines to the redirect function to fix it.

    function redirect()
        {
          // this is what the user asked for (strip out home portion, case insensitive)
          $userrequest = str_ireplace(get_option('home'),'',$this->getAddress());
          $userreqarray = explode('?', $userrequest);
          $userrequest = $userreqarray[0];
          $userrequest = rtrim($userrequest,'/');

    Thanks for the plugin :)

  2. scottnelle
    Member
    Plugin Author

    Posted 3 years ago #

    I appreciate the suggestion. I'm not sure I should implement it, though. My reasoning is that a fairly common use case for this plugin may be when someone started blogging using the default permalink settings (/?p=123) and later upgraded to better permalinks when they learned about the SEO benefits. Stripping out the query string would prevent the plugin from working for people in this situation.

    Thanks for the suggestion, though. I may add it as an option because I can imagine a lot of cases where it would be very useful.

  3. fr33think3r
    Member
    Posted 3 years ago #

    Agree about the permalink scenario, would be glad if you can add it as an option though, so that I/others don't have to hack the plugin code everytime you upgrade the plugin :)

  4. fr33think3r
    Member
    Posted 3 years ago #

    Also it would be nice to be able to add more than one redirect at a time. A little cumbersome to add one, submit, wait, add another .. :)

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic