Forum Moderators: phranque
My purpose is to LOG the transaction, before sending the browser to an 'external' url.
Example Request:
[mysite.com...]
Desired Redirect:
[externalsite.com...]
IOW, I am wondering whether Apache can handle the whole dynamic transaction, without any external cgi (or other) program.
Thanks Much!
Scott
Pull the URL from the parameter by looking at the QUERY_STRING.
Use a 301 redirect to the target URL, using the %1 backreference from there in the RewriteRule.
Be aware that this is an unsafe method as anyone who knows the format can use your site to bounce off.
You are *strongly* advised to validate the input URLs against a whitelist.
It's very easy to use a rewrite to a script that does a database lookup, and in that case you don't need to put the real URL as a parameter, but merely call by database record number.
I am wondering, however, *why* would anyone want to 'bounce' off my site? I don't understand the benefit to them... oh (I'm getting a rhema)... I guess it would be to mask the referrer and ip, right? I see your point - not good.
In regards to the scripting... does Apache have any kind of native scripting engine of it's own, or, does it require an external scripting engine (e.g. Perl, PHH)? Probably a dumb question, but thought I would ask anyway. Currently, I do all of my *programming* within a database application which has webserver capabilities (whatever Apache cannot handle, it passes off to my custom application). However, I want to minimize the hits directly to my database application: (a) to conserve resources; b) to be able to continue serving as many requests as possible, even when my db app may be offline.
So, if I go the scripting route (which appears to be the best way), I would like to make it as *light* as possible on my server box. I'm guessing Apache cannot do database lookups on it's own, so is Perl the best solution?
Thanks again.