I have the basic code to rewrite a subdomain to another page. But how do I use this to get the path of the directory specified within it and pass it to my script as well as the subdomain itself?
Current code
RewriteCond %{HTTP_HOST} ^([^.]+)(\.example\.com)$
RewriteRule ^$ handle.php [L]
I’d like to provide handle.php with the file path specified after **.example.com* and also the subdomain name in the form handle.php?path=x&subdomain=y.
Any help much appreciated!
You can access that information with
$_SERVER['HTTP_HOST']and$_SERVER['REQUEST_URI'](does also contain the query):