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
Using an .htaccess file on your website is unlikely to cause any problems. However, it is possible for errors to occur if the rules entered into the file are incorrect which may cause your site to suddenly display a 500 error. If something like this occurs, you can comment out the rules/lines you have just added by placing a ‘#’ in front of each line. Repeat this until you find the line causing the error.
Creating an .htaccess file on your DreamHost web server
- Creating and editing a file via FTP (easier for beginners)
- Creating and editing a file via SSH (for advanced users)
If you're using an FTP client, make sure it has been configured to show hidden files. This is necessary since the .htaccess file begins with a period.
Make sure that when you create the .htaccess file you do NOT add a file extension. This file should only be titled .htaccess with no extension.
Where to put your .htaccess file?
Generally, you put the .htaccess file in your website's main directory. However, the location ultimately depends on what you're attempting to do with the .htaccess file.
The .htaccess file can control behavior for every directory under the folder it resides in. For this reason it can also be in your user's home directory. Again, it depends on what you're using the .htaccess file for.