Redirections and rewrites to subdomain

by Yvonne   Last Updated May 25, 2019 15:08 PM

I am currently working on a new WordPress website, to partially replace a non-WP website that includes a webshop. Now, the plan is to migrate the webshop and all matching pages (shopping card, order confirmation page, etc.) to a subdomain, while keeping the informative pages (like About Us and Contact) on the main directory. Those informative pages on the main directory will be replaced by WordPress pages with the exact same urls (one page is the exception).

Thankfully, I'm not in charge of the migration, but I have been tasked with writing the correct redirections... and that's where I get stuck.

In short, the whole new website would be set up like this:
https://website.com/
https://website.com/about-us/
https://website.com/contact/
https://website.com/privacy/
https://shop.website.com/

What I got so far is this:

# Redirect this one page to a new url
Redirect 301 /privacy-statement https://website.com/privacy/

# Make sure these pages and their children aren't redirected
RewriteEngine on
RewriteCond %{REQUEST_URI}!^/about-us/(.*)
RewriteCond %{REQUEST_URI}!^/contact/

# Redirect the rest to the new subdomain
RewriteRule (.*) https://shop.website.com/$1 [R=301,L]

I am however not certain if this is correct... Can anyone confirm if it is correct, or give a hint regarding what I should change?

Thank you so much in advance for any help!



Related Questions