Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use regex to redirect all pages of one site to another (using Redirection WP plugin)?

I need to redirect all pages of site /old-domain/ to /new-domain/ and am having difficulty figuring out simple regex using the redirection plugin for Wordpress. Googling hasn't helped, or I'm missing something basic.

For instance, I would like to redirect /old-domain/photos/cats TO: /new-domain/photos/cats

and /old-domain/products/shoes TO: /new-domain/products/shoes

I though I should enter: old-domain/(.*) > new-domain/$1

But that had no effect.

Thanks in advance for any help.

like image 338
Haddon Venture Avatar asked Jan 23 '26 21:01

Haddon Venture


1 Answers

Thanks everyone for the help. You were absolutely correct about the syntax. Also, you can't put the original domain into the source box.

Here is the answer and syntax in case someone else finds this (I had a very difficult time googling)

To redirect olddomain.com to newdomain.com:

/(.*)
http://newdomain.com/$1/
<make sure the regex button is checked>
like image 145
Haddon Venture Avatar answered Jan 26 '26 22:01

Haddon Venture



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!