lighttpd和fastcgi.map-extension检测/内容协商重写的“干净”URL没有文件扩展名?

时间:2011-06-30 21:39:24

标签: php url-rewriting fastcgi lighttpd clean-urls

我当前的网站使用PHP构建HTML内容并将其输出到由重写的“干净”网址指定的浏览器。

url.rewrite-once = (
"^/([-a-zA-Z0-9]+)/$" => "/index.php?section=$1",
"^/([-a-zA-Z0-9/]+)/([-a-zA-Z0-9/]+)$" => "/index.php?section=$1&article=$2" 
)

index.php只是调用我的函数来构建和输出内容,具体取决于变量:

http://domain.com/some-section/this-is-an-article/

目前这只是平板HTML输出,但我现在想在平板输出中包含PHP,主要用于PHP包括在浏览器中加载页面时的调用:

<h1>lorem ipsum</h1>
<?php include_once('example.php') ;?>
<p>Dolar sit amet.</p>

我只是认为我可以通过php映射HTML:

fastcgi.map-extensions = ( ".html" => ".php" )

但是因为我的URL实际上没有文件扩展名,并且实际上也没有任何带有扩展名的物理重写页面,所以fastcgi无法映射任何内容。

我已经测试过fastcgi的工作原理只是创建一个带有嵌入式PHP的.html文件并且它被正确解析,所以我知道.html文件扩展名是通过fastcgi映射的。

我的问题很简单(或者不是这样)如果没有扩展名,如何通过PHP将fastcgi / lighttpd映射到我的输出内容?

0 个答案:

没有答案