473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Get hostname of domain alias

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

Jan 8 '07 #1
1 2565
On 8 Jan 2007 10:16:47 -0800, sp****@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 :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jan 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James M. | last post by:
I have 2x Front-end Web servers (Win2003 Ent IIS6.0), setup with NLB (single Affinity, also using SQLServer session state) that are hosting a few .NET ASP web applications under the Default Website...
3
by: HiChetu | last post by:
I have a host which has two NIC cards; one configured for LAN connections, and another for external connections. Say the ip address are 1) x.x.x.x - for LAN 2) y.y.y.y - for external ...
7
by: Peter Steele | last post by:
I have code to add a domain user to a local group but I'm not sure if it will work with NT domains or whether it will only work with Active Directory based systems. Here's the code: public void...
0
by: James M via .NET 247 | last post by:
(I have 2x Front-end Web servers (Win2003 Ent IIS6.0), setup withNLB (single Affinity, also using SQLServer session state) thatare hosting a few .NET ASP web applications under the DefaultWebsite in...
3
by: Jeff Waskiewicz | last post by:
Hello, I think the subject says it all I am trying to return a list of domain names to later display in a combobox. I found a number of VB6 samples that show how to do this using the...
0
by: Mahesh K. Anajni | last post by:
Hi We are working on a multilingual website. it has five URL (one original and four alias) for all the five languages. we are using RewriterRule in web.config to rewrite the Url. All this...
0
by: ajayindelhi | last post by:
Hi, I have two user accounts in the format: <domain>\<alias> and <fully qualified domain name>\<alias>
0
by: Rituparna | last post by:
How to set up hostname alias in HP-UX..
2
by: Dooza | last post by:
Hi there, Using classic ASP I want to check if a username and password are correct before passing the details on to an object (stocktake module) that uses them to authenticate the object. The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.