A
A
Alexey2015-05-22 20:03:38
htaccess
Alexey, 2015-05-22 20:03:38

Two domains for one site. How to configure htaccess correctly?

I can't figure it out with htaccess.
There is a main domain, it does not need redirects.
There is an alias, and so, depending on whether there is anything in the REQUEST URI or not, redirect to the a or b directory, respectively.
Tried to do something like this

RewriteCond %{HTTP_HOST} ^(.*\.)?alias.domain$
RewriteRule ^(.+)/?$ /a/$1
RewriteRule ^.*/$ /b/ [L]

but, alas, it gives a server error
It turns out like this
If you go to alias.domain it should redirect to /b/
And from alias.domain/abc it should redirect to /a/abc

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question