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.

Examples

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?

Please visit Wikipedia or one of the many sites on the subject.

Only use REGEX Redirects if you know what you are doing!

Can I create REGEX redirects with Yoast SEO?

Yes, Yoast SEO Premium also enables you to create REGEX redirects in the redirect manager. However, we advise you to only use REGEX redirects if you know what you’re doing. This type of redirect is very powerful, but you can also easily break stuff on your site.

Regex redirects in Yoast SEO Premium have support for the standard spec. This means it has support for standard string matches and capturing groups.

Screenshot showing Regex Redirects tab in Yoast SEO redirect manager
There’s a separate tab for REGEX redirects in the Yoast SEO Premium redirect manager

Can I break my website using REGEX redirects?

Yes, you can. And if you’re inexperienced with regular expressions, you will.

Did this article answer your question?

Thanks for your feedback!

Get free SEO tips!