0
votes

I have wordpress multisite with 2 sites: https://www.example1.com/ AND https://www.example2.com/

example2 site is a copy of example1, but 2 is new so I want to redirect all subsites to new domain. Example: https://www.example1.com/data/post1243545 to https://www.example2.com/data/post1243545

Everything stays the same except domain

1

1 Answers

0
votes

To answer the question as asked

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>

per https://wpscholar.com/blog/redirect-old-domain-to-new-domain-via-htaccess/

However, you could simply configure the sites to use different domains and avoid having to use htaccess entirely as described in the following link.

https://wordpress.org/support/topic/change-domain-in-multisite/