[英]nette, lighttpd - url rewrite?
I am new to the Nette Framework and have no experience with URL rewriting, so I apologize for my question. 我是Nette Framework的新手,没有URL重写的经验,因此我对我的问题深表歉意。
The default syntax of Nette's router is: Nette路由器的默认语法为:
<presenter>/<action>[/<id>]
so URLs are in format localhost/mypage/articles/view/35
因此网址的格式为
localhost/mypage/articles/view/35
My question is how to configure lighttpd to accept these urls and bind them to valid content? 我的问题是如何配置lighttpd接受这些URL并将其绑定到有效内容?
I found only configuration for Apache in the documentation: http://doc.nette.org/en/2.1/troubleshooting#toc-how-to-allow-mod-rewrite 我在文档中只找到了Apache的配置: http : //doc.nette.org/en/2.1/troubleshooting#toc-how-to-allow-mod-rewrite
try using magnet-module + lua script 尝试使用磁铁模块 + lua脚本
add magnet module to the lighttpd modules 将磁铁模块添加到lighttpd模块
server.modules = (
...
"mod_magnet",
...
)
lighttpd virtual host example: lighttpd虚拟主机示例:
$HTTP["host"] =~ "^(example.com)$" {
server.document-root = "/var/www/example.com/document_root"
magnet.attract-physical-path-to = ( server.document-root + "/rewrite.lua" )
}
create rewrite.lua file in the document_root folder (according to the setting above) 在document_root文件夹中创建rewrite.lua文件(根据上面的设置)
attr = lighty.stat(lighty.env["physical.path"])
if (not attr) then
lighty.env["uri.path"] = "/index.php"
lighty.env["physical.rel-path"] = lighty.env["uri.path"]
lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
end
-- uncomment below for debug output to stdout
-- print ("final file is " .. lighty.env["physical.path"])
credit for this post goes to 'edke' user from nette forum thread 这篇文章的功劳归于nette论坛主题的 'edke'用户
could be worth trying also this (or get inspired): http://www.guyrutenberg.com/2008/05/24/clean-urls-permalinks-for-wordpress-on-lighttpd/ 可能也值得尝试一下(或从中获得启发): http : //www.guyrutenberg.com/2008/05/24/clean-urls-permalinks-for-wordpress-on-lighttpd/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.