Score:0

Lighttpd Execute ./cgi-bin/index.cgi if exists in the folder

us flag

BusyBox httpd executes the ./cgi-bin/index.cgi if it exists. This is similar to index.php but with the /cgi-bin/ folder. So for example I have the structure:

/api/
  cgi-bin/index.cgi
/blog/
  cgi-bin/index.cgi
  /rss/
    cgi-bin/index.cgi

So when request are going to http://example.com/api/ they are actually handled by the /www/api/cgi-bin/index.cgi script. When requested http://example.com/blog/ it's processed by /www/blog/cgi-bin/index.cgi but the /blog/rss/ path is processed by /www/blog/rss/cgi-bin/index.cgi.

But now I also want to support the Lighttpd webserver. How can I achieve that?

This seems similar to Making lighttpd redirect from www.example.com to www.example.com/cgi-bin/index.pl but much more complicated.

Score:1
cn flag

The simplest solution is to use lighttpd mod_indexfile:

index-file.names = ( "cgi-bin/index.pl" )

An alternative if you want to internally rewrite the target, try lighttpd mod_rewrite:

Generically:

url.rewrite-once = ( ".*/(?:\?|$)" => "${url.path}cgi-bin/index.pl${qsa}" )

More precisely for only the paths in your example:

url.rewrite-once =
  ( "^/(?:api|blog(?:/rss)?)/(?:\?|$)" => "${url.path}cgi-bin/index.pl${qsa}" )
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.