F
F
foxayb2020-06-02 21:49:10
htaccess
foxayb, 2020-06-02 21:49:10

How to redirect from a subdomain to another site?

There is a subdomain one .example.ru /1/
The hosting provider has a limit on the number of subdomains, and, for example, creating a new subdomain two .example.ru/2/
is not possible.

Is it possible to make a redirect from two.example.ru to one.example.ru /2/ via .htaccess ? It seemed to me that it was necessary to go to the root of the site example.ru and there in the .htaccess file register a redirect from two.example.ru to one.example.ru/2 and also add an A-record to the DNS, but this does not work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2020-06-02
@shambler81

1.
make a CHNAME redirect to the DNS server, there are no restrictions, mine even * is supported there.
2. option
Add aliases to your site, all these domains, then all sites will open on the same hosting in 1 folder
3. option
you have a bunch of unnecessary domains parked to the hosting in each of them put .htacess
well, actually when waxing has one implemented of the above options, then yes, mono make a redirect by putting it in 1 htaccess
and actually

RewriteCond %{HTTP_HOST} ^two\.example\.ru$
RewriteRule ^$ http://one.example.ru/2 [L,R=301]

RewriteCond %{HTTP_HOST} ^three\.example\.ru$
RewriteRule ^$ http://one.example.ru/3 [L,R=301]
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question