i want to do it but i don't know how to, i've tried a lots of tutorials but doesn't work for me.
I have a website (PHP), that show several info depending of a parameter on URL (i interpret it with php) like this:
example.com/about.php?some=1
i want to change the URL to:
some.example.com/about.php
and get the subdomain name (some) and use it as a PHP variable.
Important: i should use this function on all my website (as a $_SESSION variable but through URL)
You can extract the subdomain from the SERVER_NAME
environment variable:
$subdomin = (explode('.', $_SERVER['SERVER_NAME']))[0];
var_dump($subdomain);
So if you hit some.domain.com
, you'll get:
string(4) "some"