How to set up different documentroot for ip based requests, and different for domain based requests
Posted
by
Carlos
on Server Fault
See other posts from Server Fault
or by Carlos
Published on 2012-10-29T02:36:01Z
Indexed on
2012/10/29
5:05 UTC
Read the original article
Hit count: 487
apache2
|virtualhost
My problem is simply that I have a domain, let's say example.com, and my server's ip address is e.g. 192.168.0.1.
I want to set up 2 different virtual hosts, so when user enters ip address (192.168.0.1) in his browser, he will see content from here: /var/www/staging
But if user will type example.com, he will see content from here: /var/www
I think it's possible but I was playing around with it and couldn't make it work.
Also I don't want to make simple redirection. I know I can, but I need both of my apps (live & staging) working in root on the same server. I can't buy second domain, and I can't associate new ip address.
© Server Fault or respective owner