Redirect IP Address to Domain Name on IIS

Redirect IP Address to Domain Name on IIS - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Redirect IP Address to Domain Name on IIS error on your web browser. Problem :


I am attempting to redirect the IP address of my domain to the domain name and am running into trouble. The IP address does not redirect to the domain name listed in the redirect statement below.



The IP Address is http://184.168.27.44/



I've setup the following rule in my web.config file:



<rule name="IPHit" enabled="true" stopProcessing="false">
<match url="(.*)" />
<conditions>
<add input="HTTP_HOST" pattern="^184.168.27.44" />
</conditions>
<action type="Redirect" url="http://littlejawsbigsmiles.com/R:1" redirectType="Permanent" />
</rule>


The DNS is setup with the following records:



A (HOST) 
------------------------
@ --> 184.168.27.44

CNAME (Alias)
------------------------
www --> @


Is there anything else that I'm mising? I'm not sure why this isnt working.


Solution :

The solution was provided on serverfault



Your rule is correct. The problem you're having is because you're on a shared hosting plan at Godaddy.com. Putting the IP in here returns:




Found 696 domains hosted on the same web server as 184.168.27.44




Since you're not the only site hosted on that IP, when a browser comes to the IP directly, the server doesn't know which site to return, so shows this error:




The page you tried to access does not exist on this server...




To be able to point to your site directly by IP, you would need dedicated hosting, which is much more expensive.



If you weren't on a shared IP, a more complete rule would look like this (tested on my own server which has a dedicated IP):



<rule name="IPHit" enabled="true" stopProcessing="false">
<match url="(.*)" />
<conditions>
<add input="HTTP_HOST" pattern="184.168.27.44" />
</conditions>
<action type="Redirect" url="http://littlejawsbigsmiles.com/R:1" redirectType="Permanent" appendQueryString="true" />
</rule>


The above is similar to your and Vysakh's answers, but adds the appendQueryString property. That's necessary if you have any URLs with a query string (something after a "?"), so that the query string gets added during the redirect.


We hope that this article has helped you resolve the redirects, dns, iis7 error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How do I redirect traffic only if being accessed from a specific port?

DNS entry to redirect constant url to changing directory name

How to redirect to any domain [duplicate]