0

I want staging.mywebsite.com to point to the staging virtual host, for the live I want mywebsite.com and www.mywebsite.com to point to the live one etc., and then for *(everythingelse).mywebsite.com needs to point to the development server.

Anyone have any idea?! I posted a couple times on StackOverflow to no avail.

EDIT: I only have 1 server! Just to be clear. I can purchase 2 more IP's if necessary however.

1 Answer 1

0

First set your DNS so that you have an A record for "" (blank), "www" and "staging" which point to the live server's IP address. Next, set another A record for "*" (ask your provider how to do a wildcard if that doesn't work) pointing to your development server.

Next, in your Apache configuration on the live server, put a ServerName of mywebsite.com with ServerAlias www.mywebsite.com pointing to the live DocumentRoot, and put a second VirtualHost in place with the ServerName staging.mywebsite.com.

Finally, on your development server, put the ServerName to be whatever you want (eg. example.mywebsite.com) and the ServerAlias to *.mywebsite.com" - you could also just use the default DocumentRoot if you want it to match anything that ends up at that server.

4
  • Do we need multiple IP addresses? Is there anyway to do all of this on one IP?
    – Walker
    Commented Aug 11, 2010 at 14:41
  • From you question it sounded as though you had at least two servers. You can do all of this on one IP address providing you don't have more than one SSL certificate.
    – James L
    Commented Aug 11, 2010 at 15:29
  • Sorry about that, I made an edit to the original question. I can purchase more IP's (I'm on RackspaceCloud) to run the dev / staging server if necessary - or, how would you solve the problem with one IP?
    – Walker
    Commented Aug 11, 2010 at 15:38
  • Just wildcard your DNS so that everything on that domain points to your server, then use Apache NameVirtualHosts to split the requests.
    – James L
    Commented Aug 11, 2010 at 15:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .