2014-04-23 6 views
1

Je suis novice dans le framework Nette et je n'ai aucune expérience de la réécriture d'URL, alors je m'excuse pour ma question.nette, lighttpd - réécriture d'url?

La syntaxe par défaut du routeur Nette est:

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

si les URL sont au format localhost/mypage/articles/view/35

Ma question est de savoir comment configurer lighttpd pour accepter ces urls et les lier à un contenu valide?

J'ai trouvé la configuration que pour Apache dans la documentation: http://doc.nette.org/en/2.1/troubleshooting#toc-how-to-allow-mod-rewrite

+0

vous avez besoin htaccess équivalent fot lighttpd - voir [question similaire] [1] [1]: http://stackoverflow.com/questions/3654 765/apache-htaccess-fichier-sur-lighttpd – petrbel

Répondre

0

essayez d'utiliser magnet-module + lua scénario

module aimant ajouter aux modules lighttpd

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

lighttpd exemple d'hôte virtuel:

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

créer un fichier rewrite.lua dans le dossier document_root (selon le réglage ci-dessus)

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

crédit pour ce poste va à « edke » utilisateur de nette forum thread

pourrait être intéressant d'essayer aussi ce (ou obtenir inspiré): http://www.guyrutenberg.com/2008/05/24/clean-urls-permalinks-for-wordpress-on-lighttpd/