Learn an Overview About .htaccess File

Learn an Overview About .htaccess File

An .htaccess file controls how Apache communicate with your website. When an .htaccess file is placed in your domain’s root directory, then the .htaccess file is founded and executed by Apache.

An .htaccess file is commonly used for the following:

  • Denying specific IPs to your site
  • Password protecting your site
  • Redirecting specific pages
  • Rewriting URLs
  • Custom error pages

Creating an .htaccess file

  • Open a new document in Notepad or any other editor you have used.
  • Now save it with the name .htaccess and make sure 'All files' is selected in the 'Save as type' drop-down menu. Doing this ensures it doesn't save it with the .txt extension.
  • Then upload an .htaccess file to your account using FTP.
  • In FTP client, change the permissions on the file to 644 (rw-r--r--). Using this permissions, the public should never be able to read your .htaccess file.

Finding .htaccess files from your FTP client

Your FTP client may suddenly decline to display the file once you rename it to .htaccess. View the show hidden files article for instructions.