Answer the question
In order to leave comments, you need to log in
Redirection from domain to domain, plus a bunch of subdomains, how to implement on .htaccess?
Hello.
There is a project to a bunch of subdomains. I'm moving to another domain with all these subdomains.
domain1.com/primer to domain.com2/primer
ga.domain1.com/hdaj to ga.domain2.com/hdaj
jask.domain1.com/sajk/isuai to jask.domain2.com/sajk/isuai
and so on, subdomains several hundred, tens of thousands of pages
How to register all this in htaccess?
Answer the question
In order to leave comments, you need to log in
Your question is written incorrectly, so there will be an incorrect answer.
at least there is no domain.com2 domain, and therefore you have already shown something wrong, so I will assume.
But based on my thoughts, I can assume that you needed this
RewriteCond %{HTTP_HOST} ^(.+)\.domain1\.com$ [NC]
RewriteRule ^(.*)$ https://%1.domain2\.com/$1 [R=301,L]
(.+)
- one or more characters \.
- just dot escaped. %1
- analogue of $1 but from RewriteCond
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question