In a web hosting or web server, often encountered many folders. Most of them contained Content Management System (CMS) or applications and plugins. However, sometimes a user stored data in a folder on a web server or hosting, it mean to share files with others.
For example, they put data in a folder called Secret_Data, then the link or URL location given to someone else to be downloaded with the address is www.yourweb.com/Secret_Data/.
This phenomenon is actually very risky and it unfortunately often done. By the helped of search engines, our data will be taken by people who are not expected.
To prevent that, there is a way that can be used. Only by making a simple file. A common file known as names .htaccess. With .htaccess file, the file storage folder could not be opened through the browser. It could only be opened using File Transfer Protocol (FTP) or through the File Manager feature in the hosting control panel.
Here are the steps:
First, create a .htaccess file.
– Open a text editor application that you usually used.
Windows users can use Notepad, Linux users can use any TextEditor or vi command in console mode. And for Mac users can use TextEdit.
– Fill this command-lines :
AuthName “Test .htaccess”
Require user test
– Save this file with the name. htaccess.
– In Linux change file attribute to 755 :
command : #chmod 755 .htaccess
Second, upload the .htaccess file into the folder you want to protect (In this case is www.yourweb.com/Secret_Data/).
– To Upload the file usually by using a FTP software.
Try to Access your folder at www.yourweb.com/Secret_Data/, and you will see that it can not be accessed anymore.