set up hosting php
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 开发者_StackOverflow社区I solve this? Do I use htaccess?
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.
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.
I agree, you can read that in order to find something that suits your problem with .htaccess :
http://www.clockwatchers.com/htaccess_dir.html
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.
精彩评论