Jump to content

$_SERVER['SERVER_NAME'] testing before changing dns


veerybird

Recommended Posts

I'm testing out my domain on a new host before I update DNS. I'm revising some absolute links using $_SERVER['SERVER_NAME'].

 

I've encountered some weirdness. Because I'm still using XX.XXX.XXX.XXX/~XXXXXX to access my pages and test them, if I use $_SERVER['SERVER_NAME'] for the domain part of the absolute link, I still have to add /~XXXXXX. I think I would have to go back in and remove the /~XXXXXX after DNS propagation. Is there another $_SERVER command I could use instead? I've already played with HTTP_HOST and DOCUMENT_ROOT and some others I found on php.net. So far, $_SERVER['SERVER_NAME']/~XXXXXX gets me what I want, but later I think it will break the links.

 

 

Yes, Mardoxx, I think you are talking about creating an include. doc_root.inc.php. So then I would need to go back into that file and change only one piece of code when I change DNS. That raises another question: Is it possible for a php site to have too many includes? I use them for code that needs to go on almost every page in the same subfolder, but I find myself reluctant to use an include for code that needs to go on one or two pages per subfolder. I think I read something somewhere once about not getting too carried away with them:)

 

Thanks for your reply!

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.