设置托管 php
我有一个 IP 为 123456 的托管网站。当我在网络浏览器中输入 ftp://123456/ 时,所有文件和文件夹都会显示列出。我该如何解决这个问题?我使用 htaccess 吗?
I have a hosted site with IP 123456. When I type ftp://123456/ into my web browser, all files and folders are listed. How do I solve this? Do I use htaccess?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
前面的答案提到了 .htaccess 解决方案,但请注意 .htaccess 文件用于控制对 Apache(以及可能的其他)Web 服务器的访问。 URL 中包含 ftp://,因此这不是 Web 访问,而是 ftp。如果您想完全禁用 FTP 访问,您的托管公司可能会提供一种方法来执行此操作。禁用目录列表同时仍允许使用 ftp 访问文件可能是不可能的,如果可以,则取决于所使用的 ftp 服务器。如果您打算编写: http://12345/,则使用类似 Options 的指令指向 .htaccess 文件的指针
-索引
或者根据网络服务器配置的设置方式,创建index.html 或index.htm 可能会阻止它。
The previous answers refer to a .htaccess solution, but note that .htaccess file is for controlling access to Apache (and possibly other) web servers. You've got an ftp:// in the URL, so this is not web access but ftp. If you want to disable FTP access altogether, there may be a way provided to do this by your hosting company. Disabling directory listing while still allowing file access with ftp may not be possible and if it is will depend on what ftp server is being used. If you meant to write: http://12345/, then the the pointers to a .htaccess file with a directive like
Options –Indexes
Or depending on how the webserver config is setup, creating an index.html or index.htm is likely to prevent it.
如果您只想隐藏列表,但可以直接访问文件,请在根文件夹中放置一个空的index.html。
如果您想限制对文件的访问,那么是的,您需要一个 .htaccess。
If you just want to hide list, but give direct access to files, then put an empty index.html in your root folder.
I you want to limit access to files, then yes, you need an .htaccess.
我同意,您可以阅读该内容,以便找到适合您的 .htaccess 问题的内容:
http://www .clockwatchers.com/htaccess_dir.html
I agree, you can read that in order to find something that suits your problem with .htaccess :
http://www.clockwatchers.com/htaccess_dir.html
您在问题中提到了 FTP 协议,我的第一个猜测是禁用匿名访问。如果您有 CPanel、Plesk 或 DirectAdmin 等控制面板,您可以进入 FTP 设置并禁用此功能。这样,只有 FTP 访问列表中指定的用户才能查看文件列表。
You stated the FTP Protocol in your question, my first guess would be to disable anonymous access. If you have a control panel like, CPanel, Plesk or DirectAdmin, you can go into the FTP settings and disable this feature. This way only a user specified in the FTP access list can see the list of files.