I use a standard web.config file in my projects which are hosted on Windows servers. Now i need to redirects non www url to www with https and remove the index.html from the url.
<system.webServer> <rewrite> <rules> <rule name="Redirect http://visasimple.com to https://www.visasimple.com HTTP" patternSyntax="ECMAScript" stopProcessing="true"> <match url=".*"></match> <conditions> <add input="{HTTP_HOST}" pattern="^visasimple.com$"></add> <add input="{HTTPS}" pattern="off"></add> </conditions> <action type="Redirect" url="https://www.visasimple.com/{R:0}" redirectType="Permanent" appendQueryString="true"></action> </rule> <rule name="redirect index.html" stopProcessing="true"> <match url="^(\w*/)?index\.html" /> <conditions> <add input="{HTTP_HOST}" pattern="visasimple\.com$" /> </conditions> <action type="Redirect" url="https://www.visasimple.com/{R:1}" /> </rule> </rules> </rewrite> <urlCompression doStaticCompression="true" doDynamicCompression="true" /> </system.webServer>
The post Redirect index.html and non www to www using web.config appeared first on PHP Blog Spot.