Jump to content

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


Recommended Posts

Guest hridaydutta
Posted

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.

 

 

 

[ATTACH type=full" alt="hridaydutta_0-1724145586617.png]63315[/ATTACH]

 

 

 

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.

 

 

 

[ATTACH type=full" alt="hridaydutta_1-1724145586625.png]63316[/ATTACH]

 

 

 

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

 

 

 

[ATTACH type=full" alt="hridaydutta_2-1724145586628.png]63317[/ATTACH]

 

 

 

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.

 

 

 

[ATTACH type=full" alt="hridaydutta_3-1724145586631.png]63318[/ATTACH]

 

 

 

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".

 

 

 

[ATTACH type=full" alt="hridaydutta_4-1724145586634.png]63319[/ATTACH]

 

 

 

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.

 

 

 

[ATTACH type=full" alt="hridaydutta_5-1724145586638.png]63320[/ATTACH]

 

[ATTACH type=full" alt="hridaydutta_6-1724145586642.png]63321[/ATTACH]

 

 

 

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.

 

 

 

[ATTACH type=full" alt="hridaydutta_7-1724145586645.png]63322[/ATTACH]

 

 

 

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

 

Continue reading...

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...