Do you know that Redirection by John Godley WordPress Plugin has more advanced redirection features?

You can use a regular expression (or regex) to automatically redirect a list of links without manually adding it to the plugin.

Redirect all Old URL to New URL

  • Redirect these:
    • https://oldsite.com/
    • https://oldsite.com/contact
    • https://oldsite.com/about
  • To the new URL:
    • https://newsite.com/
    • https://newsite.com/contact
    • https://newsite.com/about

Regex Solution

  • Source: /(.*)
  • Target: https://newsite.com/$1

Redirect Specific Sub-pages

  • Redirect these:
    • https://oldsite.com/oldpage/bananas
    • https://oldsite.com/oldpage/apple
    • https://oldsite.com/oldpage/orange
  • To the new URL:
    • https://newsite.com/newpage/bananas
    • https://newsite.com/newpage/apple
    • https://newsite.com/newpage/orange

Regex Solution

  • Source: ^/oldpage/(.*)
  • Target: /newpage/$1

Redirect date and name Post permalink

  • Redirect these:
    • https://oldsite.com/2020/01/02/my-first-blog/
    • https://oldsite.com/2021/01/02/my-second-blog/
    • https://oldsite.com/2022/01/02/my-third-blog/
  • To the new URL:
    • https://newsite.com/my-first-blog/
    • https://newsite.com/my-second-blog/
    • https://newsite.com/my-third-blog/

Regex Solution

  • Source: ^/d{4}/d{2}/d{2}/(.*)
  • Target: /$1

 

Redirect date, name to category permalink

  • Redirect these:
    • https://oldsite.com/2020/01/02/category/bananas/
    • https://oldsite.com/2021/01/02/category/apple/
    • https://oldsite.com/2022/01/02/category/orange/
  • To the new URL:
    • https://newsite.com/bananas/
    • https://newsite.com/apple/
    • https://newsite.com/orange/

Regex Solution

  • Source: ^/d{4}/d{2}/d{2}/.*?/(.*)
  • Target: /$1
ADVERTISEMENT

Leave a Comment

Subscribe to the Newsletter

Subscribe to get my latest content by email. I won't send you spam. Unsubscribe at any time.

Newsletter
ADVERTISEMENT

Similar Searches:

  • Redirect Regular Expressions