• 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: https://test.aga-parts.com/lookup/123/
    New url: https://test.aga-parts.com/lookup/?q=123
    Location: /lookup/?q=123

    5)
    I retrieve cycling redirect with these:
    https://test.aga-parts.com/lookup/?q=123
    https://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.
    [email protected]

    • This topic was modified 7 years, 1 month 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.