paradox814 1 Posting Whiz

I was working on my site, and was doing some mod_rewrites and realized that I very frequently forget to pass a 404 header if the requested page is invalid (and I found out that even this website is guilty of it!).

See this is what happens, when you use mod_rewrite technically any rule that matches is sent as OK (http status 200), even if the page shouldn't work. So for instance, while this one may work:
http://daniweb.com/techtalkforums/forum17.html
This one does not:
http://daniweb.com/techtalkforums/forum54517.html
but this last example does not send a 404 header and browsers and search engines alike assume that it is a valid page. And as we all know duplicate content from this mistake can hurt you on search engine ratings.

As soon as you find out the page is no good, you need to send the appropiate headers, for example:

header("HTTP/1.0 404 Not Found");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.