One of my client had a wordpress website say www.example.com.au in wordpress

As they wanted to have separate websites for different locations, we created subdomains for each location like sydney.example.com.au, melbourne.example.com.au and perth.example.com.au.

For this we moved the main site www.examle.com.au to sydney.example.com.au and created a html landing page on the main url www.example.com.au. Also created 2 websites for other 2 sub domains.

Thr landing page has 3 buttons for users to choose specific location websites like sydney.example.com.au or melbourne.example.com.au or perth.example.com.au. All three sub domain sites are built in wordpress.

What I want to accomplish is www.example.com.au to stay as it is and

www.example.com.au/about-us/ to be redirected to sydney.example.com.au/about-us/

www.example.com.au/team/ to be redirected to sydney.example.com.au/team/

www.example.com.au/faq/ to be redirected to sydney.example.com.au/faq/

www.example.com.au/contact-us/ to be redirected to sydney.example.com.au/contact-us/

If you can help write htaccess redirects, it would be highly appreciated



RewriteEngine On
RewriteRule ^(.+) http://sydney.example.com/$1 [R=301,L]


Using this: https://htaccess.madewithlove.be/, I tested that for any path under the root it redirects, while for the root it does not, the (.+) makes sure that only urls with something after the domain are matched.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.