Yash Raj Karthikey Yash Raj Karthikey - 3 months ago 20
HTML Question

I want to redirect nitroindia.org to www.nitroindia.org in godaddy windows hosting

I wanted to redirect my website nitroindia.org to www.nitroindia.org in windows hosting w.ith web.config file. I replaced the web.config file but It gave me a resultant 500 Internal Server error.

<?xml version=�1.0? encoding=�utf-8? ?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=�Redirect for ML2? stopProcessing=�true�>
<match url=�.*� />
<conditions>
<add input=�{HTTP_HOST}� pattern=�^nitroindia.org$� />
</conditions>
<action type=�Redirect� url=�http://www.nitroindia.org/{R:0}� redirectType=�Permanent� />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>


My default file name is index.html

Answer

I'm guessing you are using IIS 7.5 and below should work:

<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Canonical host name">
<match url="^(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.domain\.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>