• For reasons unknown, the following regex redirect with the “Redirection” plugin does not work:

    Redirection Rule (regex):
    Source URL: /holiday-craft/thanksgiving/(.*)/(.*)
    Target URL: /$2

    Browser URL Input: /holiday-craft/thanksgiving/kids-table/thanksgiving-placemats-kids/
    Expected Result: /thanksgiving-placemats-kids/
    Actual Result: /

    Any ideas?

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

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

    (@johnny5)

    The expression (.*) is greedy and will match everything until the end of the URL. Therefore the second (.*) does nothing and so $2 will be empty.

    If you change the first (.*) to be (.*?) then it will match up to the first /.

Viewing 1 replies (of 1 total)

The topic ‘RegEx Help’ is closed to new replies.