URL Redirect problems - 404 page not found [Answered]RSS

1 reply

Last post Jan 10, 2020 02:03 AM by Jalpa Panchal

  • URL Redirect problems - 404 page not found

    Jan 09, 2020 05:26 PM|iperez_genius|LINK

    I have read many threads from many location on this topic and none provide a solution, that I can implement or understand. I hope someone can help.

    We are running our help system on windows server, with IIS. The site is html, css and javascript only. It is not a .net site.

    Our url structure changed in the most recent version and I can't seem to fix the issues with URL rewriting. When I navigate to the old URL it 404s and I have logging and Failure Testing on. I get nothing out of them.

    First question: Seeings that the site is not a .net site will adding a rewrite rule to the web.config make any difference?

    Second question:

    The rule i want to rewrite is as follows

    https://subdomain.domain.com/dirA/abc%20help/dirc/file.html

    https://subdomain.domain.com/dirA/abcClient/dirc/file.html

    that is all.

    <rewrite>
    	<rules>
      <rule name="abc help to abcClient" stopProcessing="true">
         <match url="(.*)/abc%20help/(.*)" />
             <action type="Redirect" url="https://subdomain.domain.com/dirA/abcClient/{R:2}" />
      </rule>
    </rules>
    </rewrite>

    When testing the rule it passes. When running the rule, it fails.

    Anyone have any advice.

    Ilan Perez
    web Developer | Designer
  • Re: URL Redirect problems - 404 page not found

    Jan 10, 2020 02:03 AM|Jalpa Panchal|LINK

    Hi,

    iperez_genius

    First question: Seeings that the site is not a .net site will adding a rewrite rule to the web.config make any difference?

    It does not make any difference if you run URL rewrite rule with .net site or HTML site. IIS URL rewrite rule works on the matched pattern of the URL.

    iperez_genius

    The rule i want to rewrite is as follows

    https://subdomain.domain.com/dirA/abc%20help/dirc/file.html

    https://subdomain.domain.com/dirA/abcClient/dirc/file.html

    To implement this requirement you could use below url rewrite rule:

    <rule name="abc help to client" stopProcessing="true">
                        <match url="(.*)" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                            <add input="{REQUEST_URI}" pattern="(.*)/abc help/(.*)" />
                        </conditions>
                        <action type="Redirect" url="https://www.sample1.com/dirA/abcClient/{C:2}" />
                    </rule>

    The issue is in your rule no need to check the %20 in a rule. the entered URL match like abc help.

    Regards,

    Jalpa

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.