1

私は Nette Framework を初めて使用し、URL 書き換えの経験がないため、質問をお詫びします。

Nette のルーターのデフォルトの構文は次のとおりです。

<presenter>/<action>[/<id>] 

そのため、URLは形式ですlocalhost/mypage/articles/view/35

私の質問は、これらの URL を受け入れて有効なコンテンツにバインドするように lighttpd を構成する方法です。

ドキュメントでApacheの構成のみを見つけました:http://doc.nette.org/en/2.1/troubleshooting#toc-how-to-allow-mod-rewrite

4

1 に答える 1

0

magnet-module + luaスクリプトを使用してみてください

magnet モジュールを lighttpd モジュールに追加します

server.modules = (
...
        "mod_magnet",
...  
)

lighttpd 仮想ホストの例:

$HTTP["host"] =~ "^(example.com)$" {
    server.document-root = "/var/www/example.com/document_root"
    magnet.attract-physical-path-to = ( server.document-root + "/rewrite.lua" )
}

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"])

この投稿のクレジットは、netteフォーラム スレッドの「edke」ユーザーに贈られます

これも試してみる価値があるかもしれません(またはインスピレーションを得てください):http://www.guyrutenberg.com/2008/05/24/clean-urls-permalinks-for-wordpress-on-lighttpd/

于 2014-10-13T10:59:00.043 に答える