How to make system files (.htaccess, wp-config.php) writeable
Getting WP Rocket up and running usually works like a charm; install, activate—done.
Unfortunately, there are some cases where server-side settings interfere with an easy setup, and a message about missing writing permissions appears after you activated the plugin. The message can relate to your wp-config.php file:
… or your .htaccess file:
… or a number of other files and folders WP Rocket needs to be able to write to.
This document gives you an overview of possible ways to troubleshoot issues with file permissions.
Please note that contacting your web host about this type of issue may be required in certain cases.
1. Check security plugin settings
Plugins such as iThemes Security and similar ones may be protecting system files such as wp-config.php and .htaccess from being edited. Make sure that’s not the case! For details please, see this article:
Using iThemes Security with WP Rocket
Once WP Rocket is up and running, you can continue to protect wp-config.php. However, .htaccess and other files and folders should remain writable for WP Rocket, since their content might need to change according to your settings.
2. File permission settings
Once you’re sure it’s not a security plugin interfering, check whether file permissions are set properly on the server. Follow these steps:
- Connect to your server via (S)FTP.
- Find the .htaccess and/or wp-config.php files. They are located in the root folder of your WordPress installation. In rare cases, wp-config.php can be located even one level above your WordPress root folder.
- Depending on your FTP client, you should be able to right-click (or ctrl+click) on a file name and select an option like “Get Info”, or “File permissions..”, or “File attributes” from the context menu. Clicking that option should display some file info, including permissions.
- WP Rocket requires a standard setup according to WordPress rules for files/folders permission. Make sure files are set to 640 or 644, and folders are set to 750 or 755:
Heads up! On some hosting platforms, the permissions need to be different because the user running the webserver doesn’t have permission to write files. You can try with other values, such as 664, 666 for files, and 775 (even 777 for some hosting platforms). Make sure to consult with your hosting provider about this. We strongly advise against 777 permission settings.
3. Ownership Settings
If none of the above solves the issue for you, it could be caused by file ownership settings. In this case, contacting your hosting provider for further support is your best bet.
4. Using ACL (Access Control Lists)
Instead of opening recursive read, write and execution rights for everyone, you can use ACL to grant these permission levels only to the user running the processes. For example,
www-data is the typical Apache process user. This is an advanced configuration, so please check with your hosting provider about this.