I am looking to create a system which on signup will create a subdomain on my website for the users account area.
e.g. johndoe.website.com
I think it would
You could allow every subdomain in the first place and then check if the subdomain is valid. For example:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^[^.]+\.example\.com$
RewriteRule !^index\.php$ index.php [L]
Inside the index.php
you can than extract the subdomain using:
if (preg_match('/^([^.]+)\.example\.com$/', $_SERVER['HTTP_HOST'], $match)) {
var_dump($match[1]);
}
But all this requires that your webserver accepts every subdomain name.