Im working on a multivendor ecommerce website and I want to create subdomain for each new user.
My question is how do I create dynamic subdomains like http://storename.mywebsite.com ?
For the moment my website is working this way: http://mywebsite.com/storename
I get the value of store name this way:
$URL = explode('/', $_SERVER['QUERY_STRING']);
$store = $URL[0];
I got stuck in what do add in my .htaccess and how to get the value of storename from the subdomain (storename.mywebsite.com)
Currenty my .htaccess looks like this:
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
# directory browsing
Options All -Indexes
N.B
I checked some answers here and I did use a wildcard and specified A records
*.mywebsite.com IN A 127.0.0.1 =>(Server IP Address)