IP of server not working with password

Asked By 10 points N/A Posted on -

I have a problem. I bought a small VPS and everything works fine. I have a directory and a password for it. And I have a name entry, see the IP address to another server. So when I click on the IP address: *** *** *** / directory without the username and password that I can go funny … But when I click on the folder I use A: sitea.xxx.com/directory the protected area works is what I want. How can I fix this because I do not want people to see the files in that directory.

Answered By 562865 points N/A #188916

IP of server not working with password


That problem can happen if the directory in your web server doesn’t have an index file like “index.html”, “index.php”, or “index.htm”. Normally, when you create a directory on your website, that folder or directory is viewable. When someone visits your website and accidentally stumbles on that folder, all the files inside that directory can be viewed and downloaded.

To prevent this from happening, you can put an “index.php” or “index.html” file inside the directory. Now, when someone visits that directory again, it will open the “index.php” or “index.html” file instead of showing the entire contents of the directory. Now, if you have many directories on your website, it’s not possible to put an index file on every directory you create.

The easiest way of preventing a directory listing of your website is to create “.htaccess” file. Most of the time, this file already exists on your website. You just need to edit it and disable directory listing for your website. If you already have this file on your web server, open “.htaccess”, edit it, and add the following lines:

# disable directory listing
Options –Indexes

Note: after entering “Options -Indexes”, press Enter at the end of the line so that the file ends with a blank line. After this, save the file. Now, when a user visits a specific folder, he should get a “Forbidden” error on his browser.

Login/Register to Answer

Related Questions