First thing to check on a 500-Server Error is your error log. It will tell you what the problem is. If you don't have access to your error log, it's time to look for a new host; You can't do much serious server-side stuff without an error log.
I'm not sure if this is a cut-n-paste error or the effects of posting on this board, but you must have space in the RewriteConds between the characters "}" and "!", and the last line is missing the closing "]".
I tested the code I posted in msg#18, and it works correctly on my servers. The URL is rewritten, the query string is populated, and the environment variable is populated and passed to the script correctly.
Code:
DirectoryIndex cgi-bin/y/d.cgi/?index-IPP10000 index.htm
Options +FollowSymlinks -Indexes -MultiViews
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain\.com [NC]
RewriteRule \.(gif¦jpe?g¦png¦bmp)$ - [F,NC]
RewriteRule ^\.htaccess$ - [F]
#
# New Test of URL passing variables
#
RewriteRule ^([0-9]+)/([a-z]+)/?$ /cgi-bin/y/d.cgi?$2-IPP$1 [NC,E=MY_VAR:$1,C]
RewriteRule .* - [L]
#
RewriteRule ^([0-9]+)/?$ /cgi-bin/y/d.cgi?index-IPP$1 [E=MY_VAR:$1,C]
RewriteRule .* - [L]
Some of the changes (bolded) above are just clean-ups for efficiency, such as removing the redundant [L] from a rule with [F]. Others will prevent problems, such as the second RewriteCond failing for your hostname if a port number is appended.
Jim