28

I have just moved my website to new computer which uses IIS 8 from one has IIS 7.5. All but URL rewriting is working well. there is no error message than "HTTP Error 404.0 - Not Found" which I got. What I've only recognized is, there is an entry like RewriteModule (%SystemRoot%\system32\inetsrv\rewrite.dll) in website>modules setting page but, IIS 8 one has no same module. Even though I added same module to IIS 8, It didn't work. I'll be glad if I can have some suggestion about how to solve the problem. More info could be provided upon request..

Hope I could expressed what i mean properly.!

Thanks in advance,

alper

ps: url rules work well..

Daniel Daranas
  • 22,454
  • 9
  • 63
  • 116
alper
  • 389
  • 1
  • 3
  • 5

13 Answers13

10

first of all you have to check if rewrite url works well, follow this sample tutorial:

http://www.iis.net/learn/extensions/url-rewrite-module/using-failed-request-tracing-to-trace-rewrite-rules

If not, open IIS8 and check if URL rewrite icon is showing. If not download msi from here:

http://www.iis.net/downloads/microsoft/url-rewrite

and reinstall the module. Now you could see the URL Rewrite module in IIS manager while on the root node (Server node) as well as on website and web application nodes.

Hope it helps!

10

goto IIS manager->server node->application request routing cache->server proxy setting->Check enable proxy checkbox.

vsam
  • 533
  • 3
  • 23
7

I spent a couple of hours solving this issue. There are steps I went through and got the rewrite module to work fine.

  1. Reinstall rewrite module. If you don't see this module in IIS and installed application list but rewrite installer says thar is is already installed go to registry (HKLM/SOFTWARE/MICROSOFT/WINDOWS/CURRENTVERSION/Uninstall) and serach 'rewrite'. Find uninstall string and run it. It will remove rewrite module and you can install from scratch.
  2. Install Application Request Routing module for IIS.
  3. IMPORTANT! If you already have web.config with rules remove them. Create/add rules via IIS menu. This way IIS will activate ARP module that is important.
Riddik
  • 2,565
  • 1
  • 11
  • 21
  • 2
    What is the ARP module? You mean the [Application Request Routing module](https://learn.microsoft.com/en-us/iis/extensions/planning-for-arr/using-the-application-request-routing-module)? – codekaizen Oct 20 '18 at 04:01
5

I had forgotten to add the bindings for the domains to redirect from. E.g. redirect to https://www.example.com usually needs the following bindings:

These redirection rules (from SO) then worked for me:

<rule name="Redirect from non www" stopProcessing="true">
    <match url=".*" />
    <conditions>
      <add input="{HTTP_HOST}" pattern="^example.com$" />
    </conditions>
    <action type="Redirect" url="https://www.example.com/{R:0}" redirectType="Permanent" />
  </rule>
  <rule name="Redirect from non https" stopProcessing="true">
    <match url=".*" />
    <conditions>
      <add input="{HTTPS}" pattern="^OFF$" />
      <add input="{HTTP_HOST}" pattern="^www.example.com$" />
    </conditions>
    <action type="Redirect" url="https://www.example.com/{R:0}" redirectType="Permanent" />
  </rule>
Community
  • 1
  • 1
Andy R
  • 1,339
  • 10
  • 20
3

Open IIS Manager > Server > Modules > Configure Native Modules In the list, select RewriteModule and click OK

IIS Config

This works for me.

2

I just had a similar issue after a Windows Service 2008 to Windows Service 2012 update and although I haven't completely tested this, all I did was uninstall/re-install the rewrite module specifically.

Hope this helps anyone having the same issue.

Sanction10
  • 103
  • 1
  • 11
2

I also had this problem. As the OP noticed, the .dll is not registered. The installer says everything is fine, the rewrite icon is there in IIS Manager, but it's not working. Check the .dll is there (see path below). Use microsoft notepad, Really, I'm NOT joking, it has to be microsoft notepad, not even visual studio will work for this. Start notepad as Administrator and open C:\Windows\System32\inetsrv\Config\applicationHost.config

Add the following line to the <globalModules> node.

<add name="RewriteModule" image="%SystemRoot%\system32\inetsrv\rewrite.dll" />

Save, and try your rules now.

Really it has to be notepad, if you try editing applicationHost.config on a 64bit system with anything else, you're going to be pulling your hair out for hours. One of the weirdest windows anomalies I've ever seen. http://weblog.west-wind.com/posts/2008/Aug/09/Editing-Applicationhostconfig-on-64-bit-Win2008 http://dpotter.net/technical/2009/11/editing-applicationhostconfig-on-64-bit-windows/

user138720
  • 141
  • 8
  • 2
    It doesnt have to be Notepad, it can be any 64 bit editing software. I use Notepad++ 64 bit (the 32 bit will leave you in tears, LOL) – Jimbo Apr 04 '17 at 10:51
1

For me, my URL re-write worked in IIS7.5 but not in IIS8

The issue was the pattern

In IIS7.5 I had the pattern written as off

In IIS8 I had to update it to ^OFF$

MyDaftQuestions
  • 4,487
  • 17
  • 63
  • 120
0

You could try this method. After a little google search, you're not the only one with this problem --> http://forums.iis.net/t/1173537.aspx/1

  • First of all thanks for trying, but look that's a different issue. I'm sure C:\Windows\System32\inetsrv\rewrite.dll exists in both machines. but the module was not added among modules in IIS 8, but it didn't work although i added and tested again and again. I've been looking for the solution since this noon, and now its midnight here. Thanks again.. – alper Jan 30 '13 at 22:40
0

I could not find what caused the problem but I've just solved it today with re-installation windows server and IIS 8.

Thanks for your interest and valuable time,

alper

alper
  • 389
  • 1
  • 3
  • 5
0

It helped checking and fixing the rewrite rules. I know it worked earlier and I am not aware of changing it.

Tomas Kubes
  • 23,880
  • 18
  • 111
  • 148
0

Also check: Make sure this setting is false because otherwise after URL Rewriting rewrites the URL, the .NET application might re-route it back.

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
Timothy G.
  • 6,335
  • 7
  • 30
  • 46
Ben H
  • 3,136
  • 3
  • 25
  • 34
0

I also had this exact issue. The problem was that while the Application Request Routing and Rewrite modules were both installed, they weren't enabled on the website and subfolder level in IIS Manager. So they were enabled on the server level and you could configure rewrite rules on the site and subfolder level but that had no effect.

Make sure to enable the ARR and Rewrite modules on server, site and subfolder level in IIS manager, they might not be enabled by default.

Joakim Hårsman
  • 1,824
  • 13
  • 14