Forum Moderators: coopster
I was hoping to extract the search terms from the http_refererere and do some fancy error handling by providing the user with alternatives to the 'now-defuct-page' (similar in fasion to php.net).
Problem is, my provider tells me that 'I'd suggest putting up a generic 404 that redirects to your custom php based 404'. I'm assuming that I'd use a meta-redirect for this, which means that I would lose the httttp_referere data, no?
Is there some way around this?
Why would your provider recommend this to you?
I don't know about other web servers, but with Apache you can setup a custom 404 page that is displayed in lieu of the standard 404 error message. This way, as long as the page is on the local file system and not referred to with [,...] then you won't lose the environment variables.
If you, however, have the 404 page redirect to yet another page (as it sounds like your provider is recommending), then you will lose those variables.. so I wouldn't do it that way.
thanks for the swift reply!
My provider has it set up so that there is an error 'directory', and in that directory you need to put a '404'.'whatever is allowed'. Apparently PHP isn't allowed.
I'm asking him if I can use the .htaccess ErrorDocument method.
then you will lose those variables
<Is this something that I can do without harassing my provider?>
You should be able to do just about anything like this in .htaccess as long as your provider has allowed it. So to answer your question.. No, you're probably going to have to harass him again :-).
If only HTML is allowed, I wonder if you could do some sort of JavaScript redirection, and have the JavaScript resubmit all of the values (like HTTP_REFERER) that you're looking for. This is not a good way to go.. but it might be an only option.