How can I get the exact base url? for example:
if the user type like this: https://stackoverflow.com/ I have to get the same also and if like this: http://www.stackoverflow.com/. i have to get the same url also.
thanks in advance
How can I get the exact base url? for example:
if the user type like this: https://stackoverflow.com/ I have to get the same also and if like this: http://www.stackoverflow.com/. i have to get the same url also.
thanks in advance
The $_SERVER variable has a lot of values you may want to consider, one of them being $_SERVER['HTTP_HOST']
(if you want the site that's being queried).
$thisSite = 'http://'.$_SERVER['HTTP_HOST'].'/';
geting if they used a www, use stripos:
if (stripos($_SERVER['HTTP_HOST'],'www.') === 0) { /* they used www */ }