web.config direct to https

MasterJiq

Member
Jul 8, 2016
385
23
Hello,

Does someone here can share web.config to redirect to https ? I tried a lot of method and read a lot of stackoverflow's thread. All I get is 'Redirect is loop' do someone can share with me ? I am on IIS 7.5/7

Thanks.
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
Sorry @Sentinel, just saw the probs :) THANKS
Still not fixed. As I've written, changing it to https:// doesn't work, because it automatically gets redirect to http:// due to the fact they've not enabled https access.
eyqxSOK.png

You need to download the icon_habbo_small.png down on your webserver, place it inside your images folder, and provide the location to it inside the img src tag.
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
How to do with web.config @Sentinel ?
Google it, haven't got time until I'm home in about 1-2 hours.

EDIT:
1 second Google search gave the answers away:
HTML:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>
       <rewrite>
           <rules>
               <clear />
               <rule name="Redirect to https" stopProcessing="true">
                   <match url=".*" />
                   <conditions>
                       <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                   </conditions>
                   <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
               </rule>
           </rules>
       </rewrite>
   </system.webServer>
</configuration>

Sent from my SM-G928F using Tapatalk
 
Last edited:

MasterJiq

Member
Jul 8, 2016
385
23
Doing it correctly:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
               <clear />
               <rule name="Redirect to https" stopProcessing="true">
                   <match url=".*" />
                   <conditions>
                       <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                   </conditions>
                   <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
               </rule>
                <rule name="Imported Rule 1">
                    <match url="^([^.]*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php" />
                    <conditions>
                        <add input="{QUERY_STRING}" pattern="/swfs/*" negate="true" />
                    </conditions>
                </rule>
                <rule name="RequestBlockingRule1" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <conditions>
                        <add input="{URL}" pattern="/NewPrevs/_config/*" />
                    </conditions>
                    <action type="CustomResponse" statusCode="404" statusReason="File or directory not found." statusDescription="The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable." />
                </rule>
                <rule name="Imported Rule 1-1">
                    <match url="^badge-imaging/badge/([^/]+)" ignoreCase="false" />
                    <action type="Rewrite" url="/badge-imaging/badge.php?badge={R:1}" appendQueryString="false" />
                </rule>           
            </rules>
        </rewrite>
        <httpErrors>
            <remove statusCode="404" subStatusCode="-1" />
            <remove statusCode="403" subStatusCode="-1" />
            <error statusCode="403" prefixLanguageFilePath="" path="/index.php" responseMode="ExecuteURL" />
            <error statusCode="404" prefixLanguageFilePath="" path="/index.php" responseMode="ExecuteURL" />
        </httpErrors>
    </system.webServer>
</configuration>
 
@Sentinel
 

JynX

Posting Freak
Feb 6, 2016
710
438
You stated you had cloudflare can you just make a fucking "Always HTTPS" page rule in your cloudflare dashboard..



This is really a stupid 2 page thread for an issue I stated a fix for yesterday.
 

Users who are viewing this thread

Top