web_master Posted June 29, 2009 Share Posted June 29, 2009 Hi, I made a subdomain http://subdomain.domain.com if I workin in subdomain, how can I back to main domain, without to write into link "http://www.domain.com" the ./index.php dont work, the ../index.php dont work too... allways give a http://subdomain.domain.com ... thanx in advanced. T Link to comment https://forums.phpfreaks.com/topic/164037-solved-subdomain-problem/ Share on other sites More sharing options...
cunoodle2 Posted June 29, 2009 Share Posted June 29, 2009 Can I ask why you can't just link directly to the page with the full url? Are you looking for some code you can put on multiple pages or something? As far as I know there is no way to do it but let me know why and I think I may have a few ideas for you. Link to comment https://forums.phpfreaks.com/topic/164037-solved-subdomain-problem/#findComment-865341 Share on other sites More sharing options...
web_master Posted June 29, 2009 Author Share Posted June 29, 2009 OK, I will try to explain, I made a site on domain with name example: www.black.com the customer who order the site watch my work, mean how I build the site and if he want some changes, he tell me. The customer is the provider, that mean when I finish the site he will "simple rename" the domain into www.white.com. So, if I use full links in files, I will need to change all the links after rename of domainname... I hope is understble... Link to comment https://forums.phpfreaks.com/topic/164037-solved-subdomain-problem/#findComment-865344 Share on other sites More sharing options...
cunoodle2 Posted June 29, 2009 Share Posted June 29, 2009 Use something like this. Should work on all domains... <?php function domain() { $url = explode (".",$_SERVER['HTTP_HOST']); $count = sizeof($url); echo $url[$count-2].".".echo $url[$count-1] } domain(); ?> Just create an function in an include file and call it from a page and that should print the url by itself Link to comment https://forums.phpfreaks.com/topic/164037-solved-subdomain-problem/#findComment-865355 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.