php - 如何在 lighttpd 中启用 mod 重写

标签 php mod-rewrite lighttpd

我需要在 lighttpd 中启用 mod_rewrite 它不应该显示 index.php 扩展....

最佳答案

如果我理解您的问题,您需要将/index 重写为/index.php。这应该可以解决问题。

server.modules += ("mod_rewrite")
url.rewrite-once = ( 
    "^(.*)$" => "$1.php"
);

请注意,这也会转发 url,例如/image.jpg ->/image.jpg.php。如果您需要更复杂的解决方案,请调整您的问题。

关于php - 如何在 lighttpd 中启用 mod 重写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2786768/

相关文章:

php - 在 Yii 中生成 gii 代码后如何向模型添加字段?

php - 锁定 MySql 表或数据以防止获取相同的数据

apache - 将子目录重定向到子域问题

regex - Lighttpd 正则表达式重定向除一个模式之外的所有匹配模式的页面

perl - FCGI+Perl+lighttpd : POST request is empty

python - FastCGI、Lighttpd 和 Flask

javascript - Html ajax 订单,订购产品的发票

php - try block 中的代码在异常后继续执行?

apache - htaccess 规则 (mod_rewrite) 转换为 web.config 规则

wordpress - 仅针对 WordPress 网站重定向到某些 url 的 https