Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL Redirect works fine, but rewrite gives 404

I've seen similar issues but none seem to really correspond to the problem I have now...

I have the IIS7 url-rewrite-module and I'm trying to establish what I believe is "simple" rewrites. Here's what I'm using:

            <rule name="PPConnectDesigner" enabled="true" stopProcessing="true">
                <match url="^en/planetpress_connect_designer/(.*?).(html|htm)$" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                <action type="Rewrite" url="/robohelp/server?area=en&amp;mgr=agm&amp;agt=wsm&amp;wnd=Connect Designer|defaultwindow&amp;tpc=/robohelp/robo/server/en/projects/Connect Designer/Designer/{R:1}.htm&amp;RINoLog28301=T&amp;ctxid=&amp;project=Connect Designer" appendQueryString="true" logRewrittenUrl="false" />
            </rule>

This gives me a 404 error, and the detailed error information has the Handler as StaticFile and the Error Code is 0x80070002 ... however, the Requested URL is the right one, if I just copy it from the error page and paste it in another browser tab, it works fine.

Also, if I change the rule from a Rewrite to a Redirect, it works perfectly!

ADDITIONAL INFO

One thing I realized is that I do have some rules that work with rewrites. And, other than the fact that the ones that work point to files that aren't html (I've got a CSS and some javascript in there) there's only once very clear difference: the ones that don't work are pointing towards an HTML page served by a Tomcat application (specifically, RoboHelp Server). I'm wondering if that's not a relevant point: what if IIS's redirection has trouble seeing a page served by tomcat, whereas my browser has no issue with it?

like image 516
Évelyne Lachance Avatar asked Nov 01 '22 07:11

Évelyne Lachance


2 Answers

You may want to check the iis logs. They should tell you what path iis was trying to serve when the 404 happens

like image 171
Mike Avatar answered Dec 25 '22 14:12

Mike


rewrite is internal, within same server, so the server looks for page itself and doesn't ask tomcat to look for it.

always use redirect if you are already making url visible to user

http://forums.iis.net/t/1174487.aspx?How+does+URL+Rewrite+differ+from+HTTP+Redirect+

like image 36
Atul Gupta Avatar answered Dec 25 '22 13:12

Atul Gupta