• Resolved tadswat

    (@tadswat)


    Hi,

    I am using the redirection plugin which is great for single pages but I’m struggling to get it to redirect pages where there are multiple pages of content.

    So this will redirect just fine:

    from: /items/green/ to: /items/green-products/

    But if there are 10 pages of green products I want it to also forward page 2, 3, 4 et, etc so

    /items/green/page/2/ to: /items/green-products/page/2/

    Rather than add a long list I was hoping a regular expression could be used and I tried the following but it didn’t work:

    /items/green/page/(.*) to: /items/green-products/page/$1

    I’m assuming I’m just bad with regular expressions, can anyone see what is wrong here please.

    Thanks

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

    (@johnny5)

    In what way doesn’t it work? Have you enabled the regex button? Have you cleared your cache? Do you have an example that isn’t working?

    Thread Starter tadswat

    (@tadswat)

    Well don’t I feel dumb now 😉 I had not enabled the regex button, and now I have it works just fine.

    Thanks John 🙂

    Thread Starter tadswat

    (@tadswat)

    Hi John,

    Can I just ask if the following is correct.

    In the above example for green products do I have to make two redirects?

    /items/green/ to: /items/green-products/
    and then add
    /items/green/page/(.*) to: /items/green-products/page/$1

    Or will the second redirect listed above redirect the first and all subsequent pages?

    I ask because to my mind /items/green/ and /items/green/page/ are different urls but maybe your redirection code treats them as the same?

    Thanks

    Plugin Author John Godley

    (@johnny5)

    I ask because to my mind /items/green/ and /items/green/page/ are different urls but maybe your redirection code treats them as the same?

    Yes they are different URLs. The plugin will match using whatever expression you tell it to use, and your expression will not match both of those URLs.

    Thread Starter tadswat

    (@tadswat)

    Thanks John

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Redirecting multiple pages with a regular expression’ is closed to new replies.