我在Apache 2.0.X下以CGIHandler方式使用Mason,所以只有.htaccess,没有个人的
httpd.conf。

因为用的是.htaccess,所以LocationMatch没法使用,只好用FilesMatch代替,但
是这样导致dhandler不能生效。因为 Apache会抛出一个404错误,而没有触发相应
的Mason CGI脚本。于是我在.htaccess中加入ErrorDocument 404
/cgi-bin/mason_handler.cgi/令脚本可以触发调用。这样在DocumentRoot下的
dhandler的确正常,但是再深一层的子目录下则不起作用。

最后我作出修改,不用ErrorDocument 404的处理方式,改用Rewrite,幸好服务器
支持Rewrite。

于是加上这三句:
 *   RewriteEngine on
   
    RewriteCond %{REQUEST_URI} !/cgi-bin/
    RewriteRule "(.*\.html)$" "/cgi-bin/mason_handler.cgi/$1" [QSA,PT]*/
/
测试结果暂时表明,dhandler都能正常工作了。

当然,先前的FilesMatch配置要保留,这样默认页也能正常显示。

其实上面的方法虽然可行,但我还是留有两个问题,
1.在ErrorDocument 404的后面,能否加动态的参数的?例如是由哪个被访问的页
面(Request URI)引起的404。
2.Rewrite这种方式的性能如何?


-- 
Perl乐事 -- http://www.perlersh.org
我的博客 -- http://www.perlersh.org/blog.html


--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。
 要在此论坛发帖,请发电子邮件到 [email protected]
 要退订此论坛,请发邮件至 [email protected]
 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

回复