Blog Post

IIS Support Blog
2 MIN READ

IIS URL Rewrite Rule Not Working: Resolving 'HTTP Error 404.4 - Not Found' Issues.

HridayDutta's avatar
HridayDutta
Icon for Microsoft rankMicrosoft
Aug 20, 2024

Issue

 

Most of you have encountered situations where you have used IIS URL Rewrite to redirect traffic from one site to another. But in some cases, rewrite rules fail to work as expected and returns 'HTTP Error 404.4 - Not Found'. The 404.4 status code means no handler configured. Which means the file name extension of the requested URL doesn't have a handler that is configured to process the request on the Web server.

 

 

For example you have two sites hosted in IIS. Site1 bind with port 81 and Site2 bind with port 82. The requirement is to rewrite all the request coming to Site1 (port:81) should rewrite to Site2 (port:82).  The below rule is configured -

 

<system.webServer>

      <rewrite>

            <rules>

                <rule name="RewriteToPort81" stopProcessing="true">

                    <match url="^.*$" />

                    <action type="Rewrite" url="http://localhost:82/{R:0}" appendQueryString="true" />

                </rule>

            </rules>

      </rewrite>

</system.webServer>

 

Solution

 

First you need to check if the correct module is installed in IIS. To check this go to IIS Manager and open the Modules.

 

 

Within the Modules check if the correct URL Rewrite module is installed. You can get the latest IIS URL Rewrite module from this link

URL Rewrite : The Official Microsoft IIS Site

 

 

If the correct module is installed as highlighted above, the next thing you check the Failed Request Tracing logs for the request. And verify if the correct rule is invoked and it updates the URL to new one.

 

 

Here in this case you can see "RewriteToPort82" rule is invoked and it changed the request URL to http://loalhost:82/. Also verify if the HttpStatus="404" and HttpSubStatus="4".

 

 

To remediate the issue, go to IIS Manager, open Application Request Routing Cache module and open Server Proxy Settings form the right-hand Actions pane.

 

 

Within the Server Proxy Settings you will find an option to enable proxy. Check the Enable proxy  checkbox and click apply form the right-hand Actions pane as pointed in the below picture.

 

 

After this you need to restart IIS. This should resolve the URL rewrite issue. To know more about URL rewrite in IIS you can follow this article - Using the URL Rewrite Module | Microsoft Learn

 

Updated Aug 20, 2024
Version 1.0
  • Yacine16's avatar
    Yacine16
    Copper Contributor

    Hello,

    My issue is still persisting :/

    The physical path of my site points to a web.config, I have a rewrite rule that rewrites to a server.js file.

    My config works perfectly on other machines except this one, I have all the necessary modules installed.

    Any help would be appreciated

    • HridayDutta's avatar
      HridayDutta
      Icon for Microsoft rankMicrosoft

      Hello Yacine16,

      Verify that the correct URL Rewrite module is installed on your system. Additionally, ensure the Application Request Routing (ARR) module is installed and the proxy is enabled as outlined above. Use the following links to download and install the URL Rewrite module and ARR.

      Using the URL Rewrite Module | Microsoft Learn

      Install Application Request Routing | Microsoft Learn

      If the issue persists, enable Failed Request Tracing logs for more detailed insights. Best of luck with your debugging journey!

      • Yacine16's avatar
        Yacine16
        Copper Contributor

        Hello,

        Thanks for your reply, I found the fix few weeks ago.

        I just needed to reinstall the URL Rewrite module.

        Thanks!