How do classified sites use sub domains and make them work like a single Application?

336 views Asked by At

I would like to create a classified ads site like craigslist and I want to use sub domains for each city, like craigslist does.

I’m wondering if anyone knows how they spread their site out on so many subdomains and still make it work like one big site and not hundreds of little ones.

Make sense? Any idea of a classified ads script that can do that?

Think Wordpress can do that?

Thanks in advance for your reply.

1

There are 1 answers

0
sthames42 On

It's all about DNS. It can be done with a wildcard entry (*.craigslist.com) that points to a single website that decides the content to display based on the subdomain. The same thing can be done with a single A record for each subdomain in use. Which is probably what they do or else all requests to craigslist.com would go to the single IP--even the unsupported ones.

I find the best way to do it is to have a single A record for the server IP with a host name like "myserver.mydomain.com" and then add CNAME records for each subdomain redirecting to the "myserver" subdomain. This makes it so you don't have to change all the subdomain IP addresses if you move your server.

In any case, your server looks at the subdomain in the host header to determine the content to display.

Hope that helps.