Protect Your Subdirectory with .htaccess
- With a text editor such as NotePad or SimpleText, create a new file called .htaccess. Copy the code from the appropriate example in the Restriction Options section. Paste the code into the .htaccess file. If necessary, modify the code according to the instructions in the options section. Save the file with this name:
The name must begin with a . (period) and it must be in all lowercase letters, exactly as shown above.. Do not use Microsoft Word format (the .doc extension) to create this file. If you use a word processor, such as MS Word, to create this file, you must save it as Text or Text-only. If you do not, the file will not operate correctly.The .htaccess file contains the information about who is allowed into the directory, and therefore you can view the files in that directory. The controls specified in an .htaccess file apply to all the documents in that directory and the subdirectories within it.
- Upload the .htaccess file to the subdirectory you created for protected files.
- Put the files you want to protect in the subdirectory you created for protected files.
- Link to those documents wherever appropriate in your web page. Mark the link as restricted access.