Skip to content

Setting Up a Regex Redirect in Yoast SEO

A regex redirect lets you redirect many similar URLs at once by describing a pattern instead of listing every page individually.

Think of regex as:

“Match anything that looks like this and send it there.”


The Process


Go to SEO > Redirects. Click on the Regex Redirects tab. Select the Type, enter the Regular Expression (old URL pattern) and the new URL you are redirecting to. Click the Add Redirect button and clear the site cache via Hummingbird.

Example 1

Regular Expression: ^/funding-and-costs/(.*)

URL: /funding/graduate-cost-calculator


Example 2

Regular Expression: ^/masters-programs/dual-degree-programs/(.*)

URL: /student-experience/dual-degree-programs/$1 


The Details

The Two Fields That Matter

When writing a regex redirect in Yoast, you’ll mainly work with:

  1. Old URL → the pattern to match

  1. New URL → where matching pages should go


What the Main Symbols Mean

These are the only symbols that typically show up in Yoast redirects.

^

  • Always goes at the beginning

  • Prevents accidental matches elsewhere in the URL

Example:

^/about/

Matches URLs that start with /about/


 (.*)

  • The most important piece

  • Means: anything after this; any text, any length  

Example:

^/news/(.*)

Matches:

  • /news/article-1

  • /news/2024/update


$1

Used in the New URL field.

It means:

“Insert whatever (.*) matched.”

Example pair:

Old URL

^/old-section/(.*)

New URL

/new-section/$1

So:

  • /old-section/page-one → /new-section/page-one

  • /old-section/sub/page → /new-section/sub/page


Common Redirect Patterns You Can Reuse

Redirect an Entire Section

Old:

^/old-blog/(.*)

New:

/blog/$1

What this does: 
Moves everything under /old-blog/ to /blog/


Redirect Pages With the Same Start

Old:

^/programs/nursing-(.*)

New:

/programs/nursing/$1

Matches:

  • /programs/nursing-ms

  • /programs/nursing-phd

What NOT to Change Unless You Know Why

  • Don’t remove ^

  • Don’t delete parentheses

  • Don’t change $1 to something else


How to Know If You Need (.*) or Not

Situation 

Use (.*)? 

Redirecting a whole folder 

Yes 

Redirecting many similar pages 

Yes 

Redirecting one exact page 

No (use normal redirect instead) 


Final Test

After saving:

  1. Test one old URL

  1. Confirm it redirects once and lands on the right page

If something looks wrong, disable the redirect and send a ticket to tickets@gsu.uservoice.com


Keywords: redirects, yoast, regex, seo, wordpress, url-management, troubleshooting