I am using Matt Wright's formmail script across a whole bunch of domain names on my server by aliasing the main CGI directory for all of them. All of the domain's don't need CGI access except for the formmail script so I just used the single script instead of a bunch of 'em. Anyways, instead of modifying the success page for each of the domain names that use the script, I was wondering if it was possible to somehow get the script to determine what host its being called from and redirect appropriately.

So for example, I currently have something like this:

<input type=hidden name="redirect" value="http://xyq.com/contact/success.shtml">

I figured that something like $ENV{HTTP_REFERER} needs to go in there somewhere but I just don't know where.

If anyone could suggest a way to do this with the Matt Wright's script or knows of a script that already does that, it would be greatly appreciated!

Thanks.