令人困惑的 .htaccess/PHP 难题
所以...我在本地服务器上完成了一个网站,并将其上传到远程服务器。
访问远程站点会产生内部服务器错误。我认为 .htaccess
文件可能有问题。它包含以下内容:
Options All -Indexes
Options +FollowSymlinks
DirectoryIndex launcher.php
IndexIgnore */*
RewriteEngine ON
RewriteRule ^(.*)\.less$ $1.css.php [nc]
RewriteRule ^([A-Za-z]+)$ launcher.php?page=$1 [QSA,L]
最终,我尝试通过在 DirectoryIndex 行之前添加 #
来调试问题,看看会发生什么。结果:
403 禁止
您无权访问此服务器上的/site/。
这令人费解,因为所有权限似乎都没有问题...我仔细检查了 .htaccess
文件有八进制 644。
什么可能导致此问题?感谢您提前回复。
So... I finished a site on my local server, and I uploaded it to my remote server.
Going to the remote site yields an Internal Server error. I think there might be something wrong with the .htaccess
file. Here's what it contains:
Options All -Indexes
Options +FollowSymlinks
DirectoryIndex launcher.php
IndexIgnore */*
RewriteEngine ON
RewriteRule ^(.*)\.less$ $1.css.php [nc]
RewriteRule ^([A-Za-z]+)$ launcher.php?page=$1 [QSA,L]
Eventually, I tried to debug the problem by adding #
before the DirectoryIndex line to see what would happen. The result:
403 Forbidden
You don't have permission to access /site/ on this server.
Which is puzzling, because all the permissions seem to be ok... I double checked, the .htaccess
file has octal 644.
What could be causing this issue? Thanks for any responses in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢SO用户的帮助,我的问题得到了解决。
显然,如果
.htaccess
文件设置了写入权限,Apache 就会崩溃,因此我能够通过chmod
将整个目录及其中的所有内容修改为 755 来解决该问题。Thanks to the help SO users, my problem was solved.
Apparently, Apache freaks out if the
.htaccess
file has permissions set to write, so I was able to fix the problem bychmod
ing the entire directory and everything in it to 755.我遇到了同样的问题,正如错误消息所示,提到的文件具有权限
664
。我刚刚删除了组的写入权限,权限变为644
。这修复了错误。I had the same problem and as the error message says, the file mentioned was having permission
664
. I just removed the write permission for group and the permission became644
. That fixed the error.