IIS 5.1 get 404 erros after rewrite (PHP)

Topics: Developer Forum, Project Management Forum, User Forum
Jul 13, 2008 at 3:36 PM
Edited Jul 15, 2008 at 7:07 PM
Hello All,

i always get 404 errors after rewriting, have you any clues about ?
thx


Coordinator
Jul 14, 2008 at 5:59 PM

you have given not enough information.

You say you are getting 404's, but you did not say what URLs give you 404.

Every URL gives you a 404?  or is it only "/news/detail.php" that gives you 404 ?

If you request "/alex/detail.html" - does it work?  Do you get the document you expect?  If you get a 404 from that request it seems to me, it is because the document does not exist.  The IIRF has nothing to do with it.

In your IIRF log, it shows that "/news/detail.php" gets REDIRECTED to "/alex/detail.html".   Also, there is no rule that matches "/alex/detail.html" so it is not rewritten or redirected. From the log file, everything looks ok.

 

Jul 15, 2008 at 7:08 PM


Hi again,

thx for your quick answer, but the problem is always that every generated url  will not be found.
The log/rewrite is ok, but why i cannot use the new url?


Example Rule:  RewriteRule ^/help/(\d+)/(\d+)/(\d+)   /help.cfm?id=$1&active=$2&orderby=$3

LOG

Mon Jul 14 22:02:50 2008 - LogFile re-opened.
Mon Jul 14 22:02:50 2008 - AwaitIniChangeAndReinit:  TerminateWatch = FALSE
Mon Jul 14 22:02:50 2008 - FileChangeWatcher(): Await returns (TerminateWatch= FALSE)
Mon Jul 14 22:02:50 2008 - FileChangeWatcher: Await()...
Mon Jul 14 22:02:50 2008 - AwaitIniChangeAndReinit()...
Mon Jul 14 22:02:57 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Mon Jul 14 22:02:57 2008 - OnUrlMap: storing physical path (c:\inetpub\wwwroot\help\1\2\3\), in ptr (0x00125b28)
Mon Jul 14 22:02:57 2008 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Mon Jul 14 22:02:57 2008 - DoRewrites
Mon Jul 14 22:02:57 2008 - GetServerVariable_AutoFree: getting 'url'
Mon Jul 14 22:02:57 2008 - GetServerVariable_AutoFree - no joy (GetLastError()=1413)
Mon Jul 14 22:02:57 2008 - GetServerVariable_AutoFree: 128 bytes
Mon Jul 14 22:02:57 2008 - GetServerVariable_AutoFree: result ''
Mon Jul 14 22:02:57 2008 - GetHeader_AutoFree: getting 'url'
Mon Jul 14 22:02:57 2008 - GetHeader_AutoFree: 13 bytes
Mon Jul 14 22:02:57 2008 - GetHeader_AutoFree: result '/help/1/2/3/'
Mon Jul 14 22:02:57 2008 - GetServerVariable_AutoFree: getting 'QUERY_STRING'
Mon Jul 14 22:02:57 2008 - GetServerVariable_AutoFree: 1 bytes
Mon Jul 14 22:02:57 2008 - GetServerVariable_AutoFree: result ''
Mon Jul 14 22:02:57 2008 - GetHeader_AutoFree: getting 'method'
Mon Jul 14 22:02:57 2008 - GetHeader_AutoFree: 4 bytes
Mon Jul 14 22:02:57 2008 - GetHeader_AutoFree: result 'GET'
Mon Jul 14 22:02:57 2008 - DoRewrites: New Url: '/help/1/2/3/'
Mon Jul 14 22:02:57 2008 - ApplyRules: depth=0
Mon Jul 14 22:02:57 2008 - ApplyRules: Rule 1 : 4 matches
Mon Jul 14 22:02:57 2008 - ReplaceServerVariables: InputString='/help.cfm?id=$1&active=$2&orderby=$3' out='/help.cfm?id=$1&active=$2&orderby=$3'
Mon Jul 14 22:02:57 2008 - GenerateReplacementString: src='/help/1/2/3/','(null)' ReplacePattern='/help.cfm?id=$1&active=$2&orderby=$3' vec=[[  [  0, 11, 6, 7, 8, 9, 10, 11] [] ] counts=4,0
Mon Jul 14 22:02:57 2008 - GenerateReplacementString: replacing ($1) with '1'
Mon Jul 14 22:02:57 2008 - GenerateReplacementString: replacing ($2) with '2'
Mon Jul 14 22:02:57 2008 - GenerateReplacementString: replacing ($3) with '3'
Mon Jul 14 22:02:57 2008 - ApplyCaseConversion: before '/help.cfm?id=1&active=2&orderby=3'
Mon Jul 14 22:02:57 2008 - ApplyCaseConversion: after  '/help.cfm?id=1&active=2&orderby=3'
Mon Jul 14 22:02:57 2008 - GenerateReplacementString: result '/help.cfm?id=1&active=2&orderby=3'
Mon Jul 14 22:02:57 2008 - ApplyRules: Result (length 33): /help.cfm?id=1&active=2&orderby=3
Mon Jul 14 22:02:57 2008 - ApplyRules: depth=1
Mon Jul 14 22:02:57 2008 - ApplyRules: Rule 1 : -1 (No match)
Mon Jul 14 22:02:57 2008 - ApplyRules: Rule 2 : -1 (No match)
Mon Jul 14 22:02:57 2008 - ApplyRules: returning 0
Mon Jul 14 22:02:57 2008 - ApplyRules: returning 1
Mon Jul 14 22:02:57 2008 - DoRewrites: Rewrite Url to: '/help.cfm?id=1&active=2&orderby=3'
Mon Jul 14 22:02:57 2008 - HttpFilterProc: SF_NOTIFY_URL_MAP
Mon Jul 14 22:02:57 2008 - OnUrlMap: storing physical path (c:\inetpub\wwwroot\help.cfm), in ptr (0x00125b28)

Cheeso wrote:

you have given not enough information.

You say you are getting 404's, but you did not say what URLs give you 404.

Every URL gives you a 404?  or is it only "/news/detail.php" that gives you 404 ?

If you request "/alex/detail.html" - does it work?  Do you get the document you expect?  If you get a 404 from that request it seems to me, it is because the document does not exist.  The IIRF has nothing to do with it.

In your IIRF log, it shows that "/news/detail.php" gets REDIRECTED to "/alex/detail.html".   Also, there is no rule that matches "/alex/detail.html" so it is not rewritten or redirected. From the log file, everything looks ok.

 




Coordinator
Jul 16, 2008 at 5:24 PM
Edited Jul 16, 2008 at 5:25 PM

I'm sorry, I'm really not understanding here.

The log/rewrite is ok, but why i cannot use the new url? Example Rule:
  RewriteRule ^/help/(\d+)/(\d+)/(\d+) /help.cfm?id=$1&active=$2&orderby=$3 

I don't know what you mean by "why I cannot use the new url". What does it mean, to "use the new url"? I'm not trying to be dense. I just don't understand what you want.

Also, in the first post you were dealing with urls like /news/detail.php, and in your rule, you have /help/(\d+)/(/d+) - these are not the same at all.   So I honestly don't know what you want or what you are asking.  Then you appear to have edited your post, after I replied.  So now the original post with the /news/detail etc is gone.  You're moving around and I'm not sure what the problem is.