Click here to Skip to main content
15,880,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
Hi All,

In my site, a subfolder which is having some pages. For example subfolder name is "admin".

When i type url like this, http://www.mysite.com/admin it will redirect the home page automatically. Otherwise i type url like this, https://www.mysite.com/admin it will show the content for the url. The following URL rewrite rule is used.

XML
<pre>
<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
    </modules>


  <rewrite>
      <rules>
        <rule name="Redirect to HTTPS" stopProcessing="true">
          <match url=".*" />

          <conditions>
            <add input="{HTTP_CLUSTER_HTTPS}" pattern="^on$" negate="true" />
            <add input="{HTTP_CLUSTER_HTTPS}" pattern=".+" negate="true" />

          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{SCRIPT_NAME}" redirectType="SeeOther" />
        </rule>

      </rules>
  </rewrite>
  </system.webServer>
</pre>

The subfolders name are not specified in the rule. All subfolders will be created dynamically. So it will work all subfolders.

How to give url rule to redirect subfolder with "https"?
Posted
Updated 18-Feb-14 5:40am
v2

1 solution

I tried the following rules, still it is not working

<rewrite>
      <rules>
        <rule name="rule1" stopprocessing="true">
          <match url=".*" />
  
          <conditions>
            <add input="{HTTP_CLUSTER_HTTPS}" pattern="^on$" negate="true" />
            <add input="{HTTP_CLUSTER_HTTPS}" pattern=".+" negate="true" />
  
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{SCRIPT_NAME}" redirecttype="SeeOther" />
        </rule>
		<rule name="rule2" stopprocessing="true">
	  <match url="(^agent/amonticone/.*)" ignorecase="false" />
         <conditions>
             <add input="{HTTPS}" pattern="off" />
         </conditions>
         <action type="Redirect" url="https://{HTTP_HOST}/{R:0}" appendquerystring="true" redirecttype="SeeOther" />
     </rule>
      </rules>
	  
  </rewrite>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900