Cannot Get IIS 7 / Coldfusion for 404 Delivery

So ... we have a custom CMS. We have a rewrite rule that any page request (when the file does not exist) is sent to the root / index.cfm file. There we look for our database for the page in question. If the page exists, we maintain the correct template, etc. If the page does not exist, I want the server on page 404. Now I โ€œthinkโ€ that I cannot do this in IIS, since I need to process the request in CF, so it must go through. The file will always exist. When the page does not exist, I tried using <cfheader statusCode="404" > and then add some html, it puts The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. at the top of the page in front of my html. To display this page, I had to remove the 404 code handler from IIS.

Also, when I select Google, it gets 301. However, when I look at the response headers in Firefox, I get.

 Transfer-Encoding: chunked Content-Type: text/html Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET Date: Wed, 16 Jan 2013 21:31:42 GMT 404 Not Found 

I tried a combination of redirects and all kinds of things. I open IIS permission to handle 404 if there is a way, but I canโ€™t figure out how to get Coldfusion to deliver 404 correctly so that Google understands this correctly. Webmaster Tools is angry with me because I am delivering โ€œSoft 404sโ€ to this point, so I'm trying to fix it.

I also tried setting <httpErrors existingResponse="PassThrough" /> , no matter what it did, but it didn't work. I was looking for other topics, trying to figure it out, and just can't.

EDIT: By carefully examining the header information in Firebug and Chrome, I can clearly see that the headers say 404. Why is Fetch like Bing and Fetch, since Google says differently?

I tested the fact that if I add .cfm to the URLs, it will choose how Google will ship, see 404. However, without .cfm it thinks it is 301. Firebug sees it as 404. This seems like a problem with Google.

ANSWER View:

So, this morning I did more tests (right after I actually added the bounty), and I noticed that in the webmaster tools Google correctly marked one of my pages as 404. Therefore, I started to study it. I have the "Add Trailing Slash Rule" rule. Google marks domain.com/page as 301 (in my opinion, correct) to domain.com/page/ . But he notices domain.com/page/ as 404. I think using the end slash rule as I have the right way, however, I have to do something else or use the forward slash redirection in the โ€œrightโ€ way of doing things , even though Google sometimes wants to force me.

+4
coldfusion iis iis-7 coldfusion-10
source share
1 answer

I'm not quite sure that I follow the specifics of your approach, so I will give you a few things that you need to see to make this approach work well (or at least that works best for me).

In the "Error Pages" section, make sure your 404 error page is set to "Run URL on this site" (usually I point to something like "/404.cfm"). This will ensure that your ColdFusion page is called correctly on 404 pages (it looks like you are working correctly).

In the "Handler Mappings" section, double-click the handler for ".cfm". Then click the "Request Constraints ..." button. It should open the mappings tab. You cannot check the box "Call the handler only if the request is mapped to:".

This can actually trigger this operation because it means that IIS will not invoke ColdFusion if the file does not exist. This should not be a problem if your 404 is configured correctly, but still something to learn.

While you are in the "Handler Mapping" section, look for the IsapiModule with the "*" outline. Mine is always set to ColdFusion - not sure if it matters or not.

Another thing to look out for is the Default Document option. Keep in mind that this may affect you when transferring to a folder.

You can also take a look at the rewrite rule again and make sure that it does not add slashes where it already exists.

0
source share

All Articles