I want to create the sub domain for each single user dynamically. i have tried many solution but still unable to accomplice this. can you people provide us the main basic guide for this purpose?
we want this URL: RewriteRule ^([A-zA-Z0-9]+)$ agt_index.php?username=$1
this gives us: www.abc.com/abcuser
we want to change the URL to this: abcuser.abc.com
please provide us in detail help for this.
You need to first of all have a vhost set up with wildcard subdomains.
<VirtualHost *:80>
DocumentRoot /var/www/vhosts/example.com/
ServerName www.example.com
ServerAlias *.example.com
</VirtualHost>
After this, it would make more sense to use PHP to parse the subdomain and if it its not www or empty, then regard it as a possible username and work from there.
$subdomain = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], 'example.com'));