Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

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

Posts: 12
Trades: 0
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
 
 
Register now for full access!
Old 05-11-2008, 03:56 AM Re: Header problem using 404 URL re-write script
addonchat's Avatar
Super Talker

Posts: 115
Name: Chris Duerr
Trades: 0
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

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
addonchat is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Header problem using 404 URL re-write script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.48217 seconds with 12 queries