Lighttpd 和子目录

发布于 2024-11-30 08:58:38 字数 496 浏览 3 评论 0原文

我有这样的 URL:

http://example.com/dir1/...
http://example.com/dir2/...
http://example.com/dir3/...

并且我想检索 dir1dir2dir3...(它们不是真正的目录) DIR_NUMBER 环境变量:

$HTTP["host"] == "example.com" {
  $HTTP["url"] =~ "^/(.*)/" {
    setenv.add-environment = ( "DIR_NUMBER" => $1)

    url.rewrite-once = (
      "^/(.*)" => "/index.php/$1" 
    )
  }

它不起作用,有什么想法吗?是否可以 ?

谢谢。

I have URL like :

http://example.com/dir1/...
http://example.com/dir2/...
http://example.com/dir3/...

and I would like to retrieve the dir1, dir2, dir3... (they are not real directories) in a DIR_NUMBER environment variable :

$HTTP["host"] == "example.com" {
  $HTTP["url"] =~ "^/(.*)/" {
    setenv.add-environment = ( "DIR_NUMBER" => $1)

    url.rewrite-once = (
      "^/(.*)" => "/index.php/$1" 
    )
  }

It does not work, any idea ? Is it possible ?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你好,陌生人 2024-12-07 08:58:38

如果网络服务器尝试访问的不是真实文件,则需要使用 url.redirect 而不是 url.rewrite-once。

You need to use url.redirect instead of url.rewrite-once if it's not a real file which the webserver is trying to access.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文