The .htaccess file is a configuration file that helps you configure redirections, modify HTTP headers and more. Rank Math makes it easier for you to edit your .htacess file right inside your WordPress dashboard.
In this knowledgebase article, we will walk you through how to edit your website’s .htaccess file using Rank Math, and in case of any issues with the changes made, how to restore the htaccess file from the backup.
Editing htaccess File
Let’s take a look at how you can edit your .htaccess file using Rank Math.
Note: Make sure your firewall or security plugin is setup to whitelist Rank Math. Otherwise, it might block the edits made using Rank Math. You can talk to your web host about this.
1 Navigate to Edit htaccess
Inorder to edit your .htaccess file, go to Rank Math > General Settings > Edit .htaccess
2 Make Changes to htaccess
Inside this section, you will notice that there is a single text area that can be used to edit the .htaccess file. Please be careful and do read the warning above the text area before you edit the .htaccess file.
The notice warns you that changing the .htacess file can harm your website. Even if you are technically capable, you are bound to make mistakes. To prevent issues, Rank Math automatically backs up your .htacess before you modify it.
If you want to edit the .htacess file, then click the checkbox below the text. The text area below will become active, and you can then edit your .htacess file.
3 Save Changes
When you’re done making all of your changes, click Save Changes and check if the expected changes are reflected on your website.
In case, after saving the changes, if you cannot access your website, that means something went wrong and you need to restore the backup, by following the steps discussed below.
1 Access Your Website Files
Now to fix the issue, log in to your website using FTP or cPanel File Manager. At the root of your website, you can notice .htaccess file and a backup file named .htaccess-back-XXXXX.
2 Delete the Existing file
Now delete the existing .htaccess file. (You can also download a copy of the .htaccess file saved to your computer before deleting, in case, if you want to analyze what went wrong).
3 Restore the backup file
Now that you’ve deleted the .htaccess file, you can rename
Once you’ve renamed the file, you can check if your website can be accessed now.
And that’s it! If you have any other questions about editing your .htaccess file with Rank Math – don’t hesitate to reach out to our support team and we’re always here to help.
Was this article helpful?
Still need help?
Submit Your Question
Please give us the details, our support team will get back to you.