令人困惑的 .htaccess/PHP 难题

发布于 2024-10-25 23:04:56 字数 595 浏览 2 评论 0原文

所以...我在本地服务器上完成了一个网站,并将其上传到远程服务器。

访问远程站点会产生内部服务器错误。我认为 .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 技术交流群。

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

发布评论

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

评论(2

囚我心虐我身 2024-11-01 23:04:56

感谢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 by chmoding the entire directory and everything in it to 755.

夜无邪 2024-11-01 23:04:56

我遇到了同样的问题,正如错误消息所示,提到的文件具有权限 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 became 644. That fixed the error.

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