OS X 10.6 Server .htaccess、WebDAV 和 CakePHP 问题

发布于 2024-10-18 22:09:22 字数 519 浏览 8 评论 0原文

使用 CakePHP,我确实需要 .htaccess 文件工作,因此我启用了 mod_rewrite,并很快发现 OS X 的 Apache 配置阻止通过 WebDAV 上传和读取 htaccess 文件。我在 httpd.confg 中修复了这个问题,但遇到了麻烦。

Cake 的结构在三个主要位置都有这个 .htaccess 文件(还有其他位置,但这是现在最重要的) {, app, webroot}

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

一旦这些文件被复制到 OSX 服务器上的适当位置,WebDAV 就会停止工作。我无法再向目录写入或读取。我对 mod_rewrite 不太了解,但我猜如果请求是 WebDAV,我不需要应用重写规则。任何想法或修复都会非常有帮助。

With CakePHP I really need .htaccess files working so I enabled mod_rewrite and quickly found out OS X's Apache configuration blocks uploading and reading of htaccess files over WebDAV. I fixed that in httpd.confg but hit ran into a wall.

Cake's structure has this .htaccess file in three primary locations (there are others but this is what matters right now) {, app, webroot}

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

As soon as these files are copied into their place on the OSX server WebDAV stops working. I can no longer write to or read from the directories. I don't know much about mod_rewrite, but I'm guessing that I need to not apply rewrite rules if the requests are WebDAV. Any thoughts or fixes would be most helpful.

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

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

发布评论

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

评论(1

寂寞笑我太脆弱 2024-10-25 22:09:22

我也在解决这个问题,为了修复 3 次重写,我只需将我的虚拟主机指向 webroot 目录即可。

这是我放入 httpd.conf 中的代码,

NameVirtualHost localhost:80
<VirtualHost localhost:80>
    DocumentRoot "/Users/yilliot/Sites"
</VirtualHost>
<VirtualHost cake.localhost:80>
    DocumentRoot "/Users/yilliot/Sites/demo/cakephp-1.3/app/webroot"
    <Directory /Users/yilliot/Sites/demo/cakephp-1.3>
        Options FollowSymLinks
        AllowOverride All
    </Directory>
</VirtualHost>

我相信这是一个好的开始。

I am working on this problem too, to fix the 3times of rewrite, i will just point my virtual host to the webroot directory instead.

here is the code i put in my httpd.conf

NameVirtualHost localhost:80
<VirtualHost localhost:80>
    DocumentRoot "/Users/yilliot/Sites"
</VirtualHost>
<VirtualHost cake.localhost:80>
    DocumentRoot "/Users/yilliot/Sites/demo/cakephp-1.3/app/webroot"
    <Directory /Users/yilliot/Sites/demo/cakephp-1.3>
        Options FollowSymLinks
        AllowOverride All
    </Directory>
</VirtualHost>

This is a good start i believe it is.

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