<quote>
Not found by whom? Apache or tommyx?
But since it's running your script, YOU are in charge. So when you send back that header, Apache is simply forwarding your information back to the caller.
Actually Apache parses the header on every request. If the header is incomplete, Apache
will add a line. If the header is not valid code, it will discard it and generate it's own error
header. The only way for us to have 100% control and bypass Apache parsing headers is
with 'Non Parsed Headers' (NPH).
</quote>
Thanks Perkiset... here it the whole story and I am sticking to it...
1. First the reason for all this sh**t...... to begin with...
As we know real estate has a ton of stuff sold daily. So when the IDX notes that a property is sold it gets rid of it... so of course when google or anyone comes along an looks for that url it is Not Found so a normal 404 header would be sent to google and all.. and then auto redirected to a 404.php page in the case of a blog...and if you have a theme would be sent to the 404.php of the theme allowing you to mod your little heart out to effect the look and feel of the 404 results....
2. So along come tommytx and wants to tweak with the entire process....
3. So I hide in the htaccess file and look for any url with the following /mls-1234567-propaddress-propzip-and other shit.htm
4. When I see the url with "/mls-" I know its a mls request for a very specific property.
5. I have a file each 24 hours that updates with all the properties that have sold in the last 90 days... by MLS number.
6. I jump out from behind my hiding place and throw the visitior. into my index-test.php where I compare the mls nr in the url to the number in the sold.txt file on my hard drive.
7. IF sold then I can process it in any way I like.... currently just sending it to my regular 404.php handler file.
8. The way it works is that if found it sets $cnt to 1000 if not it sets $cnt to 0. I know I should have set $sold="Yes" or $sold="No" for simplification but that is my business... $cnt=1000 means sold... my call.... Thank you....
9. Now code re-explantion since we are all now on same page..
Rem.... IF $cnt = 1000 then I want to tell Google 301 moved permanently and it does every time... and then sends them on their merry way to the url that I have listed below... that all works perfect..
Rem.. Second part.. if $cnt = 0 then the file is not on my server since I know for a fact its in the sold.txt file so no need to have google or humans even bother to look for it... so the else is supposed to send a 404 Not Found header but it does not.. It sends a 302 I thing Temp moved... and then as Bompa says it now forwards to the local 404.php file which it does... But I do not want to send google or anyone a 302 I want a 404... sent in the header just like a normal 404 does... sends out header 404 then smartly shows the client the 404 page and does not send a freaking 302.
if ($cnt==1000) {
header( "HTTP/1.1 301 Moved Permanently" );
header("Location:
http://mydomain.com/mynewlocation/mynewfile.htm");
} else {
header( "HTTP/1.1 404 Not Found" );
header("Location:
http://mydomain.com/index.php?404.php");
}
When I get a chance later today... I will remove the bottom line and see if the header then gets a 404... but if that works then I will need to find a way to get the system to forward to the 404 page at the end without changing the header... blogs will find the 404.php normally when you forward them to
http://mydomain.com/index.php?404.php or I can send them directly to my 404.php page but that give a 302 also...
Ok.. don't ask me why I don't just use the normal 404 process... instead of all this... I have my reasons.....
And this should work... when I give it a 301 command it sends out a 301 it does not change it to something else.... so the 404 switch to 302 makes no sense unless I am not addressing the 404 header command correctly... Looks good to me...
Thanks for the input Bompa....but so far the nail has not been hit on the head yet... Hopefully this gives you more to analyze....
I do like Perkiset commet... "The freaking header code should not just switch arbitrairly to whatever the f***k it want to...
Answer to Perkiset.... Where is the not found coming from system or tommtyx.
From tommytxt... when I search my sold.txt file and cannot find the mls number I know that it will also be missing from the server... even though I do not check... so I don't even let the system look for it.. I just say 404 Not Found in my little mind and then tell php to process it as not found instead of 301.... So If the $cnt is set to 0 means not found.. if set to $cnt = 1000 the file will be found on the drive if you look.. but in either case I don't look, I jsut look in my sold.txt file to decide....