The. Htaccess file contains directives (instructions) that tell the server how to behave in certain scenarios and directly affect how your website functions. Redirects and rewriting URLs are two very common directives found in a.
Htaccess file, and many scripts such as WordPress, Drupal, Joomla and Magento add directives to the. Htaccess so those scripts can function. It is possible that you may need to edit the. Htaccess file at some point, for various reasons. This section covers how to edit the file in cPanel, but not what may need to be changed.
(You may need to consult other articles and resources for that information. ) There are Many Ways to Edit a. Htaccess File The easiest way to edit a. Htaccess file for most people is through the File Manager in cPanel. How to Edit. Htaccess files in cPanel’s File Manager Before you do anything, it is suggested that you backup your website so that you can revert back to a previous version if something goes wrong.
Log into cPanel. In the Files section, click on the File Manager icon. Check the box for Document Root for and select the domain name you wish to access from the drop-down menu. Make sure Show Hidden Files (dotfiles) ” is checked. Click Go.
The File Manager will open in a new tab or window. Look for the. Htaccess file in the list of files.
You may need to scroll to find it. To Edit the. Htaccess File Right click on the. Htaccess file and click Code Edit from the menu. Alternatively, you can click on the icon for the.
Htaccess file and then click on the Code Editor icon at the top of the page. A dialogue box may appear asking you about encoding. Just click Edit to continue. The editor will open in a new window. Edit the file as needed.
Click Save Changes in the upper right hand corner when done. The changes will be saved. Test your website to make sure your changes were successfully saved.
If not, correct the error or revert back to the previous version until your site works again. Once complete, you can click Close to close the File Manager window. .