The .htaccess file is an important configuration file on Apache servers (a type of web server software). The .htaccess file allows you to adjust/override the web server configuration, without the need to edit the server’s main configuration files.
How do you access the .htaccess file?
There are a few different methods to access the .htaccess file on your server:
- With a FTP or sFTP client
- Tip: Use a free & open-source FTP client such as FileZilla or CyberDuck
- With the File Manager in your webhosting control panel (such as cPanel, Plesk, or DirectAdmin)
Where is the .htaccess file located?
The .htaccess file is located in the root folder of your website. In most cases, this is the public_html folder.
Apache hides .htaccess files by default, therefore you may need to enable the “Show Hidden Files” option in the settings of the File Management tool that you’re using.
.htaccess or wp-config.php file not writeable
Really Simple SSL requires write permissions to either the .htaccess or wp-config.php files. For example to add an .htaccess redirect, add a fix to the wp-config.php file if your site is behind a load balancer, or add the secure cookie settings if you use Really Simple SSL Pro. That usually works without any issues. However, on some occasions, the plugin cannot write to either the .htaccess or the wp-config.php file and presents you with a notice that (one of) these files are not writable. This can be fixed by adjusting the permissions on these files.
Luckily, this can be done quite easily. All you need is access to your site via FTP. If you do not want to make these changes yourself, you can always send your hosting provider a message as it’s a routine job for them which they will gladly do for you!
Changing permissions of the .htaccess file
File Permissions determine who is able to read, write and execute files on the server.
You can change file/folder permissions with an FTP client, or with the built-in File Manager in your webhosting software like cPanel.
The WordPress Codex recommends configuring 644 permissions for the .htaccess file.
Changing permissions of the .htaccess file with an FTP client
Navigate to the .htaccess file, right-click the file and select File permissions…
Navigate to the .htaccess file, Right-click the file and select Info.
Changing permissions of the .htaccess file within your webhosting software (such as cPanel/DirectAdmin)
Navigate to File Manager, browse to your .htaccess file and select it.
With the file selected, click Permissions in the top menu bar.
Navigate to File Manager, browse to your .htaccess file and enable the Select checkbox for this file.
Scroll down until you find the Set Permission button, enter the desired permissions in the field and click Set Permission to apply the change.
Editing the .htaccess file
Important: Before making changes to the .htaccess file, make sure to save a (local) back-up of the original file. By doing this, you will be able to revert your changes in case anything unexpected happens.
Locate the .htaccess file on your server, then open the file in any Text Editor to make the desired changes.
Implement your changes outside of the #Begin and #End Really Simple Security comments, or they will be stripped from the file.