Jump to content

[SOLVED] Subdomain problem


web_master

Recommended Posts

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

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...

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.