Have a Question?
How to create .htaccess file?
You can create an .htaccess directly on your web server using an FTP client, cPanel internal File Manager or SSH. View the following articles for instructions on how to use either option to create the file:
- 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.
What permissions should the file have?
644 permissions are usually fine for an .htaccess file. When you create the file on the server, it should already have these permissions set, so there is most likely nothing to change.
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.