0

I have one url which having ./ [period & slash] at the end of parameter. I want to redirect that url with different location but its not even detecting in rules. I am using IIS. I want to configure this on web.config

http://somesitename.com/mypage/teachers-manual./sku/8772

needs to redirect on

http://somesitename.com/mypage/teachers-manual/sku/8772

Though I have tried solution given on Here but its not even working. But if I use same thing instead of Redirect with Rewrite then Rule start working. Not sure why its not working for "Redirect".

<rule name="Trailing Dots and spaces" stopProcessing="true">
<match url="^mypage\/(.*)([\.\s]+)\/(.*)" />
<conditions>
   <add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Rewrite" url="/index.cfm/{R:1}/{R:2}/{R:4}" appendQueryString="true" />
</rule>

Actually when I tried to write rule then url which having ./ is also not working.[ http://somesitename.com/mypage/teachers-manual./sku/8772 ]

 <rule name="Trailing Dots and spaces1.1" stopProcessing="true">
 <match url="^(.*)" />
  <conditions>
    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
  </conditions>
  <action type="Redirect" url="http://somesitename.com/newpage.html" />
 </rule>

Not sure where its wrong.

Manish
  • 11
  • 3
  • For a difference between Rewrite ans Redirect, see https://forums.iis.net/t/1174487.aspx?How+does+URL+Rewrite+differ+from+HTTP+Redirect+ – Simon Oct 19 '16 at 15:17
  • Thanks for information but solution is pending. – Manish Oct 20 '16 at 08:09
  • Did you check the request filtering for `` ? https://www.iis.net/learn/manage/configuring-security/use-request-filtering – Simon Oct 20 '16 at 16:03
  • simon its useful information but there is nothing in denyUrlSequences. Any other alternate solution. – Manish Oct 24 '16 at 04:47

1 Answers1

1

Just got more information on Post & Haacked Said for it. so I have modified file as follows and now its perfectly working for me.

<configuration>
  <system.web>
        <httpRuntime relaxedUrlToFileSystemMapping="true" />
  </system.web>
  <system.webServer>
   <rewrite>
    <rules>
     <rule name="Trailing Dots and spaces1.1" stopProcessing="true">
        <match url="^(.*)/(.*)\.\/(.*)" />
         <conditions>
           <add input="{HTTPS}" pattern="off" ignoreCase="true" />
           <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
           <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        </conditions>
        <action type="Redirect" url="/{R:1}/{R:2}/{R:3}" appendQueryString="false" redirectType="Permanent" />
     </rule>
   </rules>
 .... etc
Community
  • 1
  • 1
Manish
  • 11
  • 3