PDA

View Full Version : Associating a script with a CGI


Tadeo
12-16-2005, 08:26 AM
Hello,

I am currently evaluating the enterprise edition for use in our web store. Could I toruble someone to explain how I can associate a script with a cgi?

$VH_ROOT=/var/www/vhosts/shop.mysite.com

$DOC_ROOT=$VH_ROOT/httpdocs

CGI App Path= /var/www/vhosts/shop.lifetimemoments.com/cgi-bin/mivavm
(The CGI is outside of the document root)

I need mivavm to launch whenever the sever encounters a script with the extension .mv or .mvc


Thanks in advance

mistwang
12-16-2005, 09:37 AM
I think your question is similar to http://www.litespeedtech.com/forum/viewtopic.php?t=163

You can use a rewrite rule to archive this. you need to define a CGI context like /cgi-bin/mivavm

Then add a rewrite rule , for example

To rewrite /foo.mv to /cgi-bin/mivavm/foo.mv

lshttpd will set PATH_INFO and PATH_TRANSLATED automatically, in your script, env PATH_TRANSLATED should be the path to your script.

Tadeo
12-16-2005, 10:33 AM
Thanks for your reply. :)

How would I create a rewrite rule to change:

http://shop.website.com/merchant.mvc?Screen=CTGY&Store_Code=NOS&Category_Code=CD1

http://shop.website.com/cgi-bin/mivavm?merchant.mvc+Screen=CTGY&Store_Code=NOS&Category_Code=CD1


Would there be a way to create a generic handler for all .mv files in order to avoid having a rewrite rule for each scritpt?


Thanks again

mistwang
12-16-2005, 10:51 AM
You don't need to create a dedicate rewrite rule for each mvc script, just a generic one can handle all scripts.

try something like:
RewriteRule /(.*\.mvc?)$ /cgi-bin/mivavm?$1+%{QUERY_STRING}

To do what you want.