Parsing Current Server Domain

This is a discussion on Parsing Current Server Domain within the PHP General forums, part of the PHP Programming Forums category; Does anyone know how I would parse the domain that scripts are currently being executed in? For example: I use ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-28-2003
Jeffrey Pearson
 
Posts: n/a
Default Parsing Current Server Domain

Does anyone know how I would parse the domain that scripts are currently being executed in?

For example:

I use seperate domains for development and production. There are times I have to specify a hard coded url instead of a relative one. So for the development it would be;

dev.domain.com/somefile.php

where on the live site it would be

www.domain.com/somefile.php

I would like the script to be able to parse the domain part so it would be;

$currentdomain/somefile.php


AAny suggestions would be greatly appreciated.

Jeff Pearson
Reply With Quote
  #2 (permalink)  
Old 08-28-2003
Curt Zirzow
 
Posts: n/a
Default Re: [PHP] Parsing Current Server Domain

* Thus wrote jeffrey pearson (jpearson@usc.edu):
> Does anyone know how I would parse the domain that scripts are currently being executed in?
>
> ...
>
> dev.domain.com/somefile.php
>
> where on the live site it would be
>
> www.domain.com/somefile.php


In most cases $_SERVER['HTTP_HOST'] is what you want. It wont be
available if you access the site with the ip address.



Curt
--
"I used to think I was indecisive, but now I'm not so sure."
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:29 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0