在Apache上引导请求,并转换请求URI的显示方式

如何configurationApache以将服务器上特定URL的请求指向特定目录,同时转换处理该URL的脚本如何看到该URL?

说我有一个PHP脚本在以下目录中:

/somedir/foo/script.php

我希望所有传入HTTP请求http:// server / foo / *由/somedir/foo/script.php处理。 不过,我还想让脚本知道URI的其余部分在REQUEST_URIvariables中。
(URL的*部分是不透明的信息,只对脚本有意义,可以是任何东西)

例如:

http://example.com/foo/ 

将由/somedir/foo/script.php处理,脚本会将REQUEST_URI看作简单的“/”,

 http://example.com/foo/the/quick/brown/fox.html 

将被/somedir/foo/script.php处理,而REQUEST_URI将被视为“/the/quick/brown/fox.html”

如何configurationApache以这种方式行事?

(请注意,这完全是Apache的问题;我不想以任何方式改变脚本。)

这很容易用mod_rewrite完成,Wordpress经常使用它

 RewriteBase /foo/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /somedir/foo/script.php [L]