【发布时间】:2009-08-28 15:51:26
【问题描述】:
环境: Mac OS X Leopard 附带 Apache 2;默认 httpd.conf 没有大的变化。
我正在通过我的 .htaccess 设置一些重写,但我无法使用相对于当前目录的目标路径。
# URL: http://localhost/~davis/rewrite/.htaccess
# File: /Users/davis/Sites/rewrite/.htaccess
RewriteRule go.php target.php
# Not working
我希望规则将用户重定向到http://localhost/~davis/rewrite/target.php。它正在解析正确的物理路径,但给了我一个 404 说路径 /Users/davis/Sites/rewrite/target.php 不存在。
如果我提供完整的 URL,它会很好。
# URL: http://localhost/~davis/rewrite/.htaccess
# File: /Users/davis/Sites/rewrite/.htaccess
RewriteRule go.php /~davis/rewrite/target.php
# Works
我在这里遗漏了什么吗?在 httpd.conf 中有什么需要设置的吗?
谢谢!
编辑:相对 URL 在我的实时 Linux 服务器上正常工作。我在本地的 Mac 盒子里遇到了问题。
【问题讨论】:
标签: apache macos .htaccess mod-rewrite