Hello,
We apologize for the issue you are facing with the "robots.txt file is not writable" error on your website. Thank you for providing detailed information about the problem.
This error typically occurs when Rank Math cannot modify your robots.txt file due to certain restrictions. Here are a few steps you can take to resolve this issue:
-
Add a Filter to Allow Editing: You can add the following code to your site to allow Rank Math to edit the robots.txt file:
/**
* Allow editing the robots.txt & htaccess data.
*
* @param bool Can edit the robots & htacess data.
*/
add_filter( 'rank_math/can_edit_file', '__return_true' );
This will enable Rank Math to make changes even if there are restrictions in place.
-
Check wp-config.php File: Ensure that your wp-config.php
file does not contain the following line, which would prevent file edits:
define ('DISALLOW_FILE_EDIT', true);
If it does, change it to:
define ('DISALLOW_FILE_EDIT', false);
If this line does not exist, you can add it as shown above.
-
Physical robots.txt File: Make sure there is no physical robots.txt
file in the root folder of your website. If there is, you may need to remove it via FTP or cPanel File Manager, as Rank Math creates a virtual robots.txt file that should be managed through the WordPress dashboard.
-
Plugin Conflicts: Check if any other plugins are creating or managing the robots.txt file. If so, you may need to disable those plugins to allow Rank Math to take control.
-
Server Permissions: Since you mentioned that the file permissions are set to 644, this should generally be fine. However, if issues persist, you might want to contact your hosting provider to ensure there are no server-level restrictions preventing Rank Math from writing to the file.
If you’ve tried all these steps and still face issues, please reply to this ticket, and a human agent from the Rank Math Support team will assist you further.
Thank you for your patience, and we hope this helps resolve your issue!
Sources:
Common robots.txt Issues & How to Fix Them » Rank Math
I Can’t Edit My Website’s Robots.txt » Rank Math
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.