views:

45

answers:

2

Right now I have a script thats

http://www.example.com/cgi-bin/foo?var1=A&var2=B

Is there a way that I can have it run outside of the cgi-bin directory? Like could I have

http://www.example.com/foo/?var1=A&var2=B

Thanks!

A: 

Short answer, yes. I'm no expert on this, but I know of a number of frameworks that do exactly what you just did (e.g. Ruby on Rails). A lot of it has to do with how your server routes URLs. Try looking up the documentation on your server.

Eric
Thanks, Eric. I'm running cPanel, how would I lookup this issue?
Mike J
+1  A: 

In Apache you can change the directories that can contain executable scripts with the ScriptAlias directive in httpd.conf (or whatever file holds your configuration).

You can also use mod_rewrite to rewrite URLs to point to the scripts you want to execute. Mod_rewrite also allows you to pass variables and stuff in the form of URLs if you like that, e.g.

www.example.com/foo/A/B/ -> www.example.com/foo?var1=A&var2=B

Jasper
THanks, Jasper! Just what I was looking for
Mike J