I want to go back to something because we got sidetracked.
What would cause the search engines to fail but everytime I try it in the browser it works?
Do you mean like this?
-- Access logs report request for such-and-such file, with search engine as referer.
-- Error logs for the same request say some-other-file does not exist.
-- The filename in your access logs is the filename that comes up in a search-engine result.
-- The filename in your error logs is the filename that you get after rewriting that request.
I just detoured to double-check what happens when you rewrite to a nonexistent page. I first renamed my "I don't like your face" page and then went to my site in MSIE 5, which normally gets rewritten to this page. What I got, physically, was my custom 404 page. Access logs name the page I was aiming at, with-- oops! didn't expect this!-- a status of 200, and then the error directory's stylesheet. Error logs name the "I don't like your face" page along with "does not exist".
Well, that's unnerving. Why am I getting a 200 for a page that doesn't exist?
:: lightbulb ::
It's got something to do, in some way, with something seemingly unrelated I asked about ages ago: if you rewrite an image, you never get back a 304. Always a fresh 200, eve with back-to-back requests.
Sorry. Drifting a bit afield from your question. But out of curiosity, do the access logs that match your "file does not exist" errors show a 200 or a 404?
Regarding validating $3 I could try to compare the address entered with the one for that property, but that could bring about some problems because if there was any small difference then a valid page would not load.
Do something simple with a database at the same time that you first generate the code for the address. So $1 $2 and $3 are all stored in the same place and all you have to do is check them against each other. You probably just need to tweak some existing formatting, since obviously you know where Address #123456 is even if you don't store the information under "123 Main Street".
If there's a mismatch, bounce the visitor back to the page that displays the properties, or whatever it is you do when people come in "cold". Or send them to a custom error message that says "We goofed!" That always sounds nicer than "You deliberately tried to mess up our database, didn't you?"