I am currently using the code below to point all subdomains to their document root.
RewriteCond %{HTTP_HOST} ^(.*)\.example\.co [NC]
RewriteRule ^(.*)/?$ http://example.co/%1/$1 [P]
subdomain.example.co will point to example.co/subdomain but the URL will remain untouched.
The problem with this is that when you try to retrieve the URL, through PHP, it will always return example.co/subdomain despite the fact that the URL bar displays it as a subdomain. I believe this is due to the Proxy flag.
How could I achieve the same effect but allow for the actual URL that the user is on (the subdomain) to be retrieved?
Overall
allsubdomains.example.co should point to example.co/allsubdomains
The URL should remain as allsubdomains.example.co
When retrieving the current URL through PHP, it should return allsubdomains.example.co