- Forums
- PHP
- How To Add Www On A Domain Name Infront Of The Url
This Page Contains information about How To Add Www On A Domain Name Infront Of The Url By tutorial in category PHP with 0 Replies. [1125], Last Updated: Sat May 18, 2024
tutorial
Sat Mar 08, 2008
0 Comments
1378 Visits
let say you have a script and and you want to know the current domain name but if the hostname is not on the url then add it.
for example, i want to force http://wallpaperama.com to be http://www.wallpaperama.com
i can use this
<?
$domainname = $_SERVER['HTTP_HOST'];
if(!strstr($domainname,'www.')){
$domainname = str_replace('www.','',$string);
}
?>