Skip to content
Advertisement

Website keep showing IIS Windows Server page

I had configured our wordpress website on the IIS Server. We have a domain name with SSL, I had configured (site binding with mysql URLs) my website from local URL to live domain URL. I am also redirecting http to https by using the below rules into wp.config file:

<rules>
                <rule name="Incomegenius.net" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
                </rule>
</rules>

With the help of the above redirection, We can able to properly redirect from http to https URL. But, When I am trying to access our website URL without any http or https (only website name), It will redirect to IIS Windows Server page Why? So, I want, when somebody types only website URL (e.g. google.com) into the address bar without http or https, so it will not redirect to IIS windows Server page.

Is there any more redirections I need to set? or what else need to do, please suggest.

Advertisement

Answer

The browser will automatically prepend a http(s):// to the name. However, I suspect you’re using an older browser that automatically prepends http://www. …this will fail as your rule won’t match subdomains, thus, you end up on the IIS default page. Change your redirect action to this:

<conditions>
    <add input="{HTTP_HOST}" pattern="^(.*)incomegenius.net$" />
    <add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://incomegenius.net{REQUEST_URI}" appendQueryString="true" />

This will redirect to the non-www. HTTPS URL regardless of the subdomain used.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement