• Skip to main content
  • Skip to primary sidebar
  • Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

yoast seo regex redirects example

April 22, 2025 By Raju Ginne

here is the regex redirect rule you can use in Yoast SEO’s redirect manager to redirect URLs like /t/mytag to /tag/mytag.

In Yoast SEO Redirects:

  1. Go to SEO -> Redirects.
  2. Click on Add new redirect.
  3. In the “Origin URL” field, enter:

    Code snippet

    ^/t/(.*)$
    
  4. Make sure the “Regex” checkbox (or similar option indicating regex) for the Origin URL is checked.
  5. In the “Redirect to URL” field, enter:
    /tag/$1
    
  6. Choose the desired redirect type (usually 301 for permanent).
  7. Click Add redirect.

Explanation:

  • ^: Matches the beginning of the URL path.
  • /t/: Matches the literal characters /t/.
  • (.*): This is a capturing group.
    • .: Matches any character (except newline).
    • *: Matches the previous character (.) zero or more times. So, .* matches everything after /t/.
    • (): The parentheses capture the matched content (everything after /t/) so it can be used in the destination.
  • $: Matches the end of the URL path. This ensures it only matches paths that exactly start with /t/ and contain nothing else before the end (preventing matching things like /t/something/else).
  • /tag/$1: This is the destination URL.
    • /tag/: The new literal path start.
    • $1: This is a backreference to the content captured by the first capturing group (.*) in the Origin URL.

This rule will take whatever comes after /t/ in the original URL and place it after /tag/ in the new URL. Remember to test it after adding!

About Raju Ginne

AMFI Registered mutual fund distributor based in Hyderabad. you may contact me for mutual funds SIP investments Whatsapp: 9966367675.
nism certified research analyst

Primary Sidebar

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy