1. This website uses cookies to improve service and provide a tailored user experience. By using this site, you agree to this use. See our Cookie Policy.
    Dismiss Notice

How do I redirect non www pages to www on a windows server & index.php to abc.com for https ?

Discussion in 'White Hat SEO' started by pulkitseo, Jun 27, 2016.

  1. pulkitseo

    pulkitseo Senior Member

    Apr 25, 2013
    Likes Received:
    Home Page:
    Hello I have below listed requirements for re-directions :
    • 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
    Please help me with code.
    Below is the code which i find is right.

    <?xml version="1.0" encoding="UTF-8"?>
    <modules runAllManagedModulesForAllRequests="true" />
    <rule name="DefaultRule" stopProcessing="true">
    <match url="^index.php" />
    <action type="Redirect" url="/" />
    <rule name="CanonicalHostNameRule1" stopProcessing="true">
    <match url="index\.asp(?:l)?" />
    <add input="{HTTP_HOST}" pattern="domain\.com$" />
    <action type="Redirect" url="http://www.domain.com/" />
    <rule name="CanonicalHostNameRule2" stopProcessing="true">
    <match url="(.*)" />
    <add input="{HTTP_HOST}" pattern="^domain\.com$" />
    <action type="Redirect" url="http://www.domain.com/{R:1}" />

    Thanks and regards