I
I
Ivan Erokhin2021-10-05 22:16:37
Apache HTTP Server
Ivan Erokhin, 2021-10-05 22:16:37

Redirect from subdomain to directory?

Help me to understand.
The site was on a subdomain:
https://subdomain.site.com/
Now it has been moved to the directory of the main site:
https://site.com/subdomain

how to correctly set up a redirect (in .htaccess) so that all traffic from the subdomain is sent to the directory?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-10-05
@dero

RewriteEngine on

RewriteCond %{HTTP_HOST} subdomain\.site\.com [NC]
RewriteRule .* https://site.com/subdomain/$0 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question