What are Regex redirects?

When using normal redirects, you add a source and destination URL. One source always points to one destination. Sometimes you want to redirect more than one source to a destination. In those cases, you can use our Regex Redirects. These are redirects that use Regular Expressions to match multiple source URLs and redirect all of them to the destination. We only recommend using Regex Redirects if you have experience with redirecting URLs, to avoid breaking your website.


What is a Regex redirect?

example screenshot of showing the difference between normal redirect and regex redirect.
Examples of Regex redirects

If you go to example.com/rain, you would be redirected to mydomain.com/sunny/, as you would with a normal redirect. However, the same goes for example.com/in-the-rain or example.com/draining. Both would be redirected to example.com/sunny/.

The second line will redirect you to /sunny-holidays/ if your URL contains /rainy-holidays/ followed by any lowercase character, number or the – and ends with a /. So /rainy-holidays/london/ would be redirected, while /rainy-holidays/buda+pest/ would not.

Want to learn more about regular expressions? We recommend this RegexBuddy tutorial.

How to create Regex Redirects in Yoast SEO Premium

With Yoast SEO Premium you can create Regex redirects in the redirect manager. However, we advise you to be careful: this powerful redirect can easily break your site. Regex redirects in Yoast SEO Premium have support for the standard spec: it has support for standard string matches and capturing groups.

Follow the steps below to create Regex Redirects in Yoast SEO Premium.

  1. In your WordPress Dashboard, go to Yoast SEO


  2. In the Yoast SEO menu, go to Redirects

  3. In the Redirects menu, go to the Regex Redirects tab


  4. Fill in your Regex redirects


  5. Click Add Redirect to change your redirects


  6. You have successfully created a Regex Redirect

Did this article answer your question?

Thanks for your feedback!

Related articles

Get free SEO tips!