🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: fj.net.www.servers
2 messages
2 total messages Started by Takahide Nojima Thu, 23 May 2002 12:00
[Q]apacheで/foo/をGETしたら、/cgi-bin/foo/bar.cgiに
#252
Author: Takahide Nojima
Date: Thu, 23 May 2002 12:00
34 lines
2629 bytes
nojimaです。

 [Q] Unix上でApacheを使います。ここで、
     
    http://FQDN/foo/ をGETしたら、
    http://FQDN/cgi-bin/foo/bar.cgi がGETされる

    (もちろん、$(APACHE)/cgi-bin/foo/bar.cgiが実行されて結果がクライア
    ントに返却されるという意味です)

  ようにしたく思います。ここで、fooは任意の文字列であり、bar.cgiは固定
  とします。また、Queryが、/foo/(ディレクトリのみの指定)以外の場合は、
  Query通りのものが返却されることとします。

   (つまり、具体的には、
     http://FQDN/abcd/をGETしたら、
     http://FQDN/cgi-bin/abcd/bar.cgiがGETされ、
     http://FQDN/efgh/をGETしたら、
     http://FQDN/cgi-bin/efgh/bar.cgiがGETされるが、
     http://FQDN/abcd/hogehoge.htmlをGETしたら、
     http://FQDN/abcd/hogehoge.htmlがGETされなければならない。もちろん、
     http://FQDN/abcd/index.htmlをGETしたら、
     http://FQDN/abcd/index.htmlがGETされなければなりません。つまり、
     http://FQDN/ディレクトリ名/ がGETされた時だけ、
     /cgi-bin/ディレクトリ名/bar.cgiをGETしたいのです。)


   このような設定はApacheの何の機能を使えば実現出来ますでしょうか?ご存じの
  方は教えてください。

#mod_rewriteつかってみたのですが、GET /foo/というディレクトリ名称その
ものをマッチさせることってそのままじゃ出来ないような...
--
  Takahide Nojima
Re: [Q]apacheで/foo/をGETしたら、/cgi-bin/foo/bar.cgiに
#253
Author: ASADA Kazuhisa
Date: Thu, 23 May 2002 13:53
14 lines
1641 bytes
Takahide Nojima <nojima@taito.co.jp> さんは、
  <tzz1yc3krax.fsf@nightmare.hm.taito.co.jp> に書きました:

>     http://FQDN/foo/ をGETしたら、
>     http://FQDN/cgi-bin/foo/bar.cgi がGETされる

 こんなカンジでしょうか?

    RewriteEngine On
    RewriteRule ^/([a-zA-Z0-9]*)/$ /cgi-bin/$1/bar.cgi [PT]

 ※正規表現の部分は必要なものに置き換えてください。
-- 
浅田和久/大阪市在住
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads