Answer the question
In order to leave comments, you need to log in
How to make subdomains using .htaccess and Apache settings, namely Server Alias *test.ru?
Hello!
A very interesting question arose, at least for me. How to make subdomains using .htaccess and Apache settings, namely Server Alias *test.ru.
There are a lot of ready-made solutions for subdomains from folders, for example, convert test.ru/sub using .htaccess to the sub.test.ru subdomain.
But mine is a little different. There is one page folder, it contains an index.php file. If we turn to a file with a GET request, for example test.ru/page/?t=test, we will get the content of the page. So Here's how to make pages open at test.art-gur.ru, where test is a GET request.
I got something like this code.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.art-gur.ru
RewriteCond %{HTTP_HOST} ([^.]+)\.art-gur.ru
RewriteRule ^index\.php(.*)$ /page/?t=%1 [L,QSA]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question