gpt4 book ai didi

macos - 为什么 fatfree 在 Mac 上需要 RewriteBase 而不是 Ubuntu?

转载 作者:行者123 更新时间:2023-12-04 18:36:11 27 4
gpt4 key购买 nike

我最近在 Ubuntu 上使用了很多 FatFree,并且将它放入子目录没有问题。但是,我最近尝试在 Mac (10.6.8) 上的用户网站上执行此操作并遇到 problem of needing a RewriteBase for the routing to work .

我想知道是否有人知道为什么 Ubuntu 上的默认 Apache 设置似乎允许路由在 .htaccess 中没有 RewriteBase 的情况下工作,但 Mac 上的设置使它成为必要。

Ubuntu 设置使用了一堆 VirtualHost,而 Mac 配置只有一个服务器配置,启用了 mod_userdir 和一个针对每个用户的站点目录的指令。

最佳答案

mod_rewrite documentation表示需要 RewriteBase 指令,除非以下任一条件为真:

  • The original request, and the substitution, are underneath the DocumentRoot (as opposed to reachable by other means, such as Alias).
  • The filesystem path to the directory containing the RewriteRule, suffixed by the relative substitution is also valid as a URL path on the server (this is rare).


您的 Ubuntu 设置可能满足第一个条件,但您的 Mac 设置不满足,因为您使用的是 mod_userdir。如果您将文件从 ~/Sites 移动到 DocumentRoot(Mac 上的默认值为/Library/Webserver/Documents),您可能不再需要 RewriteBase。

关于macos - 为什么 fatfree 在 Mac 上需要 RewriteBase 而不是 Ubuntu?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17630050/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com