views:

54

answers:

1

Hi,

I am planning for multiple sub-domain names based on city, something like city1.mydomain.com, city2.mydomain.com, ... All sub-domains will point to same file structure on main domain. Then in my program I would like to capture the city name and display content based on city.

What is the best approach to identify the city (based on the sub-domain selected). - By reading the host name? - or by htaccess mod-rewrite? - or something else?

Thanks!

+1  A: 

city1 is no sub-domain but a hostname of mydomain.com.

but nevermind. you have one vhost with all city* as alias of this host. so each request to one of the hostnames will be served by the same script.

in the script you determine the hostname and display your content accordingly.

Rufinus