Support » Plugin: Redirection » redirection works except on page.php?article…

  • Resolved petemason2019

    (@petemason2019)


    I’m using the Redirection plugin. It works fine except where I need it most…

    Firstly, my old static pages (on a bespoke website) redirect fine using the plugin:

    /page.php?page=50_12846
    goes to its destination fine in the Redirection plugin:
    http://www.socialistnigeria.org/1550/2009/11/26/nigeria-on-the-brink/

    (No need to escape the period in page.php – good!)

    But my article posts on my old website had urls of the form
    /page.php?article=1234

    And it kinda seems that “article” is a problem.

    My new wordpress site has the same article IDs so I expected the Redirection plug in to send a simple (non regex) test url:

    /page.php?article=3836
    to go to
    /3836/2019/05/07/urgent-need-for-speedy-construction-and-repair-of-roads-in-agbado-oke-aro-lcda-to-prevent-tragedy-in/

    But it gives me a 404.

    Redirect to ?p=3836 also gives a 404.

    Hope someone can help.

    Incidentally, I’m only using the Redirection plugin because I had the same problem in a direct edit of .htaccess,
    RewriteRule ^page\.php?article=([^/\.]+)/?$ /?p=$1 [R=301,L]
    but I guess that’s different forum, might be a different problem, and in any case, Redirection is more convenient.

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Godley

    (@johnny5)

    WHat redirect did you create for this?

    Hi John,
    Thanks for getting back to me.

    I’ve put two screen shots on the site for you:

    Redirection 1

    Redirection 2

    I hope this explains the situation. redirection1 shows all the redirects.
    redirection2 shows the one at the bottom that is a simple redirect to see why the general case is not working.

    I’ve disabled the general case regex version (.*) while testing the simple version shown in redirection2 but it makes no difference.

    I hope its something very simple that I’m not doing.

    Thanks again.
    Pete

    Plugin Author John Godley

    (@johnny5)

    You need to escape all the characters that are also regular expression characters:

    ^/page\.php\?article=(.*)

    Brilliant thanks John, solved.

    I see now. I had tried

    ^/page\.php\?article\=(.*)

    But the = is not escaped.

    And /page.php?page=34_6789 works without escapes because it is not regex.

    Wow. Duh.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.