There are several scenarios wherein you may want to edit your .htaccess file such as –
Basic Usage of .htaccess file
» To block a particular IP address.
» Rewriting URLs
» When changing the permalink structure
» In order to secure your website.
Ways to edit .htaccess file
There are 3 ways to edit this file
1) From Cpanel
2) Using WordPress plugins
3) Using FTP method
1) From Cpanel
Step 1: Login to cpanel
Step 2: Open File Manager.
Step 3: Select public_html/www OR Document root and tick the check-box for show hidden files before clicking GO. htaccess is a hidden file so make sure you have selected the option for show hidden files.
Step 4: Right click and edit the .htaccess file as shown below –
2) Using WordPress Plugin
There are two popular plugins which you can use to edit .htaccess file. One is “WordPress SEO by Yoast“, as we all know that this is one of the best plugin for SEO, it also provides the feature to edit .htaccess and robots.txt file.
You can download WordPress SEO plugin from here.
Another useful WordPress plugin is “WP Htaccess Editor“. See below image, it has two tabs one for editing the file and another for taking the backup of existing file.
You can find WP Htaccess Editor plugin here.
3) FTP method
FTP method is one of the popular way to take the backup of files and to transfer the files from your desktop to the root folder of your website (public_html/www).
You can try any FTP client such as FileZilla. There are mainly 3 steps involved while editing the file using this method, which are – connect to the host, backup the file and then move the updated file from desktop to root.