Answer the question
In order to leave comments, you need to log in
How to create subdomains via htaccess?
It is necessary that the user1.site.ru
content be displayed at the address site.ru/users.php?user=user1
. Accordingly, instead of user1, there can be anything. A simple cheap host for 3 acres, that is, there is no access to the insides. I enabled autosubdomains (*.site.ru), the problem is in .htaccess, I don’t know about it.
Should I throw it in the www folder, and not in the root of the site?
It doesn't work like this:
RewriteCond %{HTTP_HOST} ^([a-zA-Z0-9]+\.)?site\.ru
RewriteRule ^(.*) users.php?user=%1 [L]
Answer the question
In order to leave comments, you need to log in
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.site\.ru$
RewriteCond %{HTTP_HOST} ^(.*)\.site\.ru$
RewriteRule ^(.*)$ http://site.ru/users.php?login=%1 [L,P]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question