Bruno
Bruno

Reputation: 4527

Map *.domain.com to a single address

I´m not sure if this is really a programming question, but it's related to what I'm doing which is... I'm developing a web site that will have a lot of .domain.com, and based on what contain, the web site will show diffrent content.

Anyone knows how to do that? Maybe it requires changes in the DNS server.

Upvotes: 1

Views: 417

Answers (3)

Seiti
Seiti

Reputation:

After setting the dns to point all the subdomains to the same IP, you can also configure Apache to rewrite the url to route the request. (http://httpd.apache.org/docs/2.2/misc/rewriteguide.html). That is, if you're into Apache =)

Upvotes: 0

Joe Skora
Joe Skora

Reputation: 14920

After you have the DNS entries all pointing to the same box, you can use Apache virtual hosting to make them behave and appear as separate web servers, without the overhead of multiple Apache instances.

Upvotes: 0

John Sheehan
John Sheehan

Reputation: 78152

You need a wildcard DNS entry to point all of those subdomains to the same IP (the one your web server uses). Then sort it out in your application code which site to show based on the host header.

Upvotes: 2

Related Questions