I've created a subdomain that I can use for testing purposes. Is there a way to extract either www or test from the URL?
Links on the webpage will dynamically point to the right place if I can get this figured out.
I don't know if there's a php function to do this, but i just came up with this.
$str = 'test.domain.com';
$temp = explode('.', $str);
$subdomain = implode('.', array_splice($temp, 0, -2));
You could just use links relative to the http root. Might make things easier.
The BEST solution would depend on what method you are using to get the URL in the first place. but let say you have managed to get the URI into a sting before you finally echo it.SINCE you know the length of your old domain=4, why not do this:
$URI="test.yourdomain.com";$URI="www".sbstr($URI,4);// deletes the first four characters... eg.:'TEST' and adds 'www'
hope that helps
This topic is now closed. New replies are no longer allowed.