You can create a .htaccess file on your local computer or on the server.
On your computer:Windows:Â Using Notepad save the file as .htaccessÂ
Mac OS X:Â Using TextEdit save the file as ".htaccess"Â
Note:Â If you save the file as .htaccess it will be hidden and you will not be able to see it in the Finder.
Using your preferred FTP client upload the file to the server. The .htaccess file will need to be in the folder where your site is located, typically the public_html folder.
On the server
- Login to your cPanel Account
- Click theÂ File ManagerÂ icon, located in theÂ FilesÂ section.
- From the File Manager popup chooseÂ "Choose Hidden Files (dotfiles)."Â
Note:Â If you do not see this popup you will need to click theÂ "reset all interface settings"Â link at the bottom of the cPanel page.
- From the File Manager popup choose the folder you would like to open, most often theÂ "Web Root (public_html/www)"
- Click theÂ GoÂ button.Â
Note:Â If you are in the File Manager already you can addÂ &showhidden=1Â to the end of the URL.
- Click theÂ New FileÂ icon to create a new file and name it .htaccess
Alternative Index Files
You may not always want to use index.htm or index.html as your index file for a directory, for example, if you are using PHP files in your site, you may want index.php to be the index file for a directory. You are not limited to 'index' files though. Using .htaccess you can set foofoo.blah to be your index file if you want to!
Alternate index files are entered in a list. The server will work from left to right, checking to see if each file exists, if none of them exist it will display a directory listing (unless you have turned this off).