Reply
Header problem using 404 URL re-write script
Old 05-11-2008, 12:37 AM Header problem using 404 URL re-write script
Novice Talker

Posts: 12
Hi,

I'm using a 404 URL rewrite script for my site so I get perfect URL's but everything gets farmed through a single script located in index.php.

(I am using ErrorDocument 404 /index.php in my .htaccess file)

This all works perfectly, however it throws out 404 response headers, even though the first line of code in index.php is header("HTTP/1.1 200 OK");. Obviously this is crucial to get you SE indexed.


The other strange thing is that the exact same script sends out the correct 200 header on another server (running php 5), but not on this one (running php 4).

Unfortuantely I can't upgrade the php as this ones a shared server, so is there any way people can think of that I can try to for the 200 header response to be thrown out instead of the 404.

Thanks
feelice is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 05-11-2008, 02:56 AM Re: Header problem using 404 URL re-write script
addonchat's Avatar
Skilled Talker

Posts: 97
Name: Chris Duerr
You want your index.php script to handle inquiries where a page cannot be found? (http://www.w3.org/Protocols/rfc2616/...html#sec10.4.5) and you're concerned that page requests that don't exist be indexed in a search engine?

In Apache, (as far as I know) a 404 will send a redirect only if it points to a remote URL, so there really shouldn't be a need to to manually output an HTTP 200 response -- your server should handle this for you all by itself with an internal redirect.

Usually an index.php file handles more than just 404 requests, so you might want to consider rewriting your ErrorDocument directive to include a GET parameter. E.g., ErrorDocument 404 /index.php?404 or similar.

As far as search engine indexing goes, you'd be surprised how well they handle non-existing requests, not only internal (which should be oblivious to a bot) but also external redirects. I've had external 404 redirects show up in google before believe it or not.
__________________
Chris Duerr
AddonChat Java Chat Software
http://www.addonchat.com/ - Affiliate Program
addonchat is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Header problem using 404 URL re-write script
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11400 seconds with 13 queries