• Hello, i do not understand why the wordpress moving $_GET[q] to part of url.

    I try to do redirect:
    1)
    The ‘lookup’ is post_type page with slug ‘lookup’.

    2)
    Routes:

    add_rewrite_rule($rule = 'lookup\/page\/([0-9]+)\/?$', 'index.php?pagename=lookup&paged=$matches[1]', 'top');
    add_rewrite_rule($rule = 'lookup\/(.+[^\/])\/?$', 'index.php?pagename=lookup', 'top');
    add_rewrite_rule($rule = 'lookup\/?$', 'index.php?pagename=lookup', 'top');

    3)
    I already did flush_rewrite_rules(false). Twice.

    4)
    Current url: http://test.aga-parts.com/lookup/123/
    New url: http://test.aga-parts.com/lookup/?q=123
    Location: /lookup/?q=123

    5)
    I retrieve cycling redirect with these:
    http://test.aga-parts.com/lookup/?q=123
    http://test.aga-parts.com/lookup/123/?q=123
    Location: /lookup/?q=123"

    I do not understand why the 123 is merging to URL even if before i sent Location /lookup/

    Thanks for the help.
    grigoriy@aga-parts.com

    • This topic was modified 6 years, 6 months ago by grigoriy1991.

    The page I need help with: [log in to see the link]

  • The topic ‘WordPress is adding $_GET[q] to path automatically. Don’t know why.’ is closed to new replies.