What are REGEX redirects?

Last update: 09 September, 2016

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

kb-regex-redirects-2

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.

Can I break my website using REGEX Redirects?

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

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

Will Yoast create REGEX redirects for me?

No. However, if you are having trouble with REGEX and believe our plugin is not processing them correctly, please contact the support team to report the issue.

Was this article helpful? ·