V
V
VisualIdeas2017-05-16 21:12:10
htaccess
VisualIdeas, 2017-05-16 21:12:10

Proper redirect to new domain with subdomains?

There is a site
old.com, with a bunch of subs like sub1.old.com, sub2.old.com, sub3.old.com...
Is it possible to somehow transfer the site to a new domain while respecting the subs using htaaccess?
I somehow started digging like this, but how to replace the steering wheel already in the rewrite ((((

RewriteCond %{HTTP_HOST} !([^\.]+)\.new.com$ [NC]
RewriteRule ^$ ????????????????

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-05-17
@VisualIdeas

RewriteCond %{HTTP_HOST} (.+)\.old\.com$ [NC]
RewriteRule ^(.*)$ http://%1/new.com/$1  [QSA,L,R=301]

Actually, the chip in %1 is an analogue of $1, it is only taken with RewriteCond

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question