You are here: Re: Get hostname of domain alias « PHP Programming Language « IT news, forums, messages
Re: Get hostname of domain alias

Posted by Andy Hassall on 01/08/07 19:10

On 8 Jan 2007 10:16:47 -0800, spride@gmail.com wrote:

>Relatively new with PHP, so forgive me if this is a trivial question.
>I have a site hosted with PHP. I'm thinking of getting another
>hostname and alias it to this host. What I'd then like to do is have a
>PHP file (i.e., index.php) that reads a variable from the request that
>tells me which hostname is being served. I can then change the title
>and whatnot of the returning HTML, depending on which hostname was
>used. For example:
>
><?php
> $HOSTNM = ???
>
> if ( $HOSTNM == 'abcefg.com' )
> $TITLE = 'ABCDEFG';
> else
> $TITLE = 'HIJKLM';
>
> etc...
>?>

Try $_SERVER['SERVER_NAME'] or $_SERVER['HTTP_HOST'].

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация