I'm keeping an existing WordPress website but changing the domain name. The old domain name will be redirected to the same website, so if someone went to https://oldexample.com they would arrive at https://newexample.com.
From what I have read will need to do a 301 redirect from the old slugs to the new URLs, like this:
redirect 301 /old-page/ https://newexample.com/new-page
But in every article I've read online this approach assumes that the old slug is named something different to the slug.
But in my case, all of the pages have the same slug but will have a different domain. For example: A slug from the old domain might be my-cool-page and with the new domain there is also a page called my-cool-page, and according to what I've read I would need to do this:
redirect 301 /my-cool-page/ https://newexample.com/my-cool-page
But, and here is my question: Wouldn't this cause a redirect loop? Or can I simply get away with this:
redirect 301 https://oldexample.com/my-cool-page/ https://newexample.com/my-cool-page