Add the following for the directory where you want tp prevent hijacking
Action nohijack /cgi-gin/nohijack.cgi
AddHandler nohijack .cgi
The name of the image will be sent to the script as extra path info. Of course, you will need to create the nohijack.cgi script in the cgi-bin directory