pulkitseo
Supreme Member
- Apr 25, 2013
- 1,342
- 233
Hello I have below listed requirements for re-directions :
Below is the code which i find is right.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<rewrite>
<rules>
<rules>
<rule name="DefaultRule" stopProcessing="true">
<match url="^index.php" />
<action type="Redirect" url="/" />
</rule>
<rule name="CanonicalHostNameRule1" stopProcessing="true">
<match url="index\.asp(?:l)?" />
<conditions>
<add input="{HTTP_HOST}" pattern="domain\.com$" />
</conditions>
<action type="Redirect" url="http://www.domain.com/" />
</rule>
<rule name="CanonicalHostNameRule2" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain\.com$" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:1}" />
</rule>
</rules>
</rules>
</rewrite>
</system.webServer>
</configuration>
Thanks and regards
- Redirection to be done is on secure server.
- Window server hence web config file is required (need coding)
- Non www to www url
- abce.com/index.php to abc.com
Below is the code which i find is right.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<rewrite>
<rules>
<rules>
<rule name="DefaultRule" stopProcessing="true">
<match url="^index.php" />
<action type="Redirect" url="/" />
</rule>
<rule name="CanonicalHostNameRule1" stopProcessing="true">
<match url="index\.asp(?:l)?" />
<conditions>
<add input="{HTTP_HOST}" pattern="domain\.com$" />
</conditions>
<action type="Redirect" url="http://www.domain.com/" />
</rule>
<rule name="CanonicalHostNameRule2" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain\.com$" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:1}" />
</rule>
</rules>
</rules>
</rewrite>
</system.webServer>
</configuration>
Thanks and regards