Chmod 777 文件和文件夹。还是看不到?
我网站上的 /images 文件夹中有一些 pdf 文件。所有图像都可以在网站上查看并且工作正常,但我无法访问 pdf 文件。我收到 404 错误。
当我将文件移至 /downloads 时,它们工作正常。
/images 或 /downloads 中没有 .htaccess 文件。 所有文件权限均为777。 所有文件夹权限均为 777。
我希望不必将所有非图像文件移出文件夹,然后为新位置进行重定向/重写。
除了权限之外,还有什么可能阻止我查看文件吗?
I have a few pdf files in my /images folder on my website. All images are viewable on the site and working fine, but I can't get to the pdf files. I get a 404 error.
When I move the files to /downloads, they work fine.
There are no .htaccess files in /images or /downloads.
All file permissions are 777.
All folder permissions are 777.
I would prefer NOT having to move all non image files out of the folder and then making redirects/rewrites for the new location.
Is there something besides permissions that could be preventing me from viewing the files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在这里有点冒险,但这可能与与文件关联的内容类型有关。您可能需要在 Apache 配置中添加
application/pdf
作为受支持的 MIME 类型,以允许下载目录之外的 pdf 文件...I am going on a limb here, but it may have something to do with the
content-type
associated with the file. You may need to addapplication/pdf
as a supported MIME type in your Apache config to allow pdf files outside of the download directory...也许您只是在网络服务器中设置了错误的树路径,请仔细检查。
如果您仍然可以打开服务器上的任何文件,请在浏览器中检查其路径,将其与您的网络服务器路径结合起来,那么您肯定可以正确修复它。
Maybe you just set up a wrong tree path in your webserver, double check it.
If you can still open any files on your server, check its path in your browser, combine it with your webserver path, then surely you can fix it correctly.
图像文件夹中有一个 .htaccess 文件,该文件阻止访问除图像文件之外的任何内容。
Apache conf 中的设置阻止了 .htaccess 文件在搜索中返回,因此我不知道这些文件的存在,这进一步加剧了问题。
谢谢,
拜伦
There was a .htaccess file in the images folder that prevented anything except image files from being accessed.
The problem was further compounded by settings in Apache conf that prevented .htaccess files from being returned in a search so I was unaware of the files existence.
Thanks,
Byron