I have a Windows Server 2008 R2 virtual machine with IIS 7.5 hosting a ASP.NET MVC4 website. The WinServer has a public ip address. I also purchased a domain name. The domain name hosting company forwards requests to my server.
For example, when a customer types http://www.mycompany.com, the request is redirected to 217.151.XXX.XXX which is my server’s public ip address.
When the customer is redirected to my server, everything is working. He sees a homepage in the web browser and with address http://www.mycompany.com in browser’s address bar. However, when he browses through different pages in the websites and got redirected, the browser’s address bar displays 217.151.xxx.xxx/order/detail instead of http://www.mycompany.com/order/detail.
I tired IIS url rewrite which rewrites 217.151.xxx.xxx/order/detail to http://www.mycompany.com/order/detail
But that results in the browser freezing, waiting for a response. My guess is that when IIS rewrites the url to http://www.mycompany.com/order/detail, it sends a request back to the domain name hosting company. The company interprets the request and redirects it back to 217.151.xxx.xxx which causes a infinite loop.
How can I have the domain name always displayed in the borwser’s bar?
A very general issue when we map domain with IP
Check this out.
http://help.lockergnome.com/windows2/Domain-static-IP-mapping–ftopict485575.html