|I am attempting to use PHP code to do redirection (rewriting) of URLs on my site, using the header("Location: ... function. This is because some of my URL text searches and changes are rather complex and are very difficult to do in .htaccess. Having good string-handling functions makes it much, much, easier. Anyway, the redirection works, but the problem is that POST data from forms is lost in the process. This is a well-known problem due to the way that header() is implemented.|
My question is, what is the best way to deal with this problem? I see many solutions suggested, but they all seem to involve modifying the action script (data receiver) to, e.g., use GET instead of POST. The thing is, I want to plug arbitrary forum, blog, and ecommerce software into my site, and not have to track down all the action scripts and modify them. Some sensitive data shouldn't be exposed in a GET string, anyway. In other words, the Holy Grail is to rebuild the POST data so that the unmodified form data handlers in various apps don't even realize there's been a redirection. Is there a good, clean, application-independent way to do this? I have been studying the WordPress code, but it's so poorly documented that I'm just not sure how they handle it. Can anyone give a lead on where to look for this?