G
G
gejarufu2014-06-26 00:12:50
Domain name market
gejarufu, 2014-06-26 00:12:50

How to make dynamic subdomains on local machine?

Actually the question is higher. In the "hosts" file * does not help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Smurov, 2014-06-26
@smurov

You can set up htaccess and programmatically monitor addresses :)
You need to set up a virtual host on the server:
VirtualHost.....
...
ServerAlias ​​*.yourdomain.ru
...
/VirtualHost
Then .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([ a-zA-Z]+\.)?yourdomain\.ru
RewriteRule ^(.*) index.php?d=%1 [L]
And catch, for example, from php (vasiliy.yourdomain.ru):
echo $_GET ['d'] ; // vasiliy
Didn't check if it works, but you'll figure it out there :)
ps this is for apache

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question