Edit Htaccess WordPress

How to Edit the .Htaccess File In WordPress Using cPanel?

edit the .htaccess file

While running a WordPress blog, there are many files about which you should know. One of the most important files is the .htaccess file. Have you ever added any code to this file? Well, you should know how to edit the .htaccess file in WordPress? This file isn’t the common file you think. 

The working of this text file is enormous and it would be hard for you to gather all the jobs. Suppose you want to add a code to improve the speed of your website then you have to edit .htaccess WordPress file.

What is the .htaccess file?

This is just a text file with multi-tasking features. If you want to redirect any page then .htaccess will guide the server about it. If you want to compress the HTML and .txt file then you have to edit the .htaccess WordPress file to put the code.

If you want to leverage the browser cache then .htaccess is the source for that. It guides about the appearance of the web pages. It controls many aspects of the web pages. Whenever someone requests a web page by entering the request in the web browser, the browser will send it to the web server which will look in the .htaccess file.

I have heard complaints from many users that they can’t find their .htaccess file. In such situations, you can create this file again.

In many web hosting, when you install WordPress the file gets generated by default. It will look like this:-

Though with the addition of the plugins, the file will increase with the codes. For adding any extra code, you have to edit the .htaccess WordPress file using cPanel. There are some plugins using which you can edit this file from your WordPress admin panel only.

Do you know how to edit the .htaccess file

I am going to provide the best way using which you won’t do any mistake. But make sure that you have the backup of this file. It is always recommended to have the backup of your whole site and the database.

And if you go to edit this file then back it up because every time you edit this file, it gets saved and changed.

You can use any plugin or cPanel to edit .htacces WordPress file. In this post, I am going to show you how to edit the .htaccess file from cPanel. There are some simple steps to follow.

Step 1:- The first step is to login to your web hosting account. Open the cPanel and go to the files section.

Step 2:- In this section, you can see many options from which you have to choose “file manager“. Select the web root directory. Most of the time it is selected by default. Make sure that the “show hidden files” option is checked. It is because .htaccess is the hidden file. You can’t see it if you don’t allow to show those type of files in your web root directory.

edit htaccess wordpress

Make sure that the “show hidden files” option is checked. It is because .htaccess is the hidden file. You can’t see it if you don’t allow to show those type of files in your web root directory.

Step 3:- After opening the web root directory, you have to find the .htaccess file from many files. You can edit .htaccess WordPress file just by right-clicking on the file and an option of “edit” can be seen.

You can also edit the file by selecting it and choose an “edit” option from above.

how to edit the htaccess file

Just add the code you want to put in this file and click on the save button on the right top of the file. The file would be saved and then you can check whether the code you have placed is working or not. If it doesn’t work then you can edit .htaccess cPanel file and remove the code.

I Hope You can edit the .htaccess WordPress file

There are many people like to play with the codes. But what if something goes wrong. So follow the steps carefully you will know how to edit the .htaccess file in WordPress. The backup you have generated earlier can be uploaded to your web server if something goes wrong with this file.

Just edit .htaccess WordPress file and don’t engage with any other file in the web root directory. You should know the importance of this file and how to edit the .htaccess file.

by Ravi Chahar

A WordPress Professional and the LinkedIn Influencer. A coder by passion and a blogger by choice. WordPress theme development is his forte. He is your WordPress guy who will teach you how to solve WordPress errors, WordPress security issues, design issues and what not.


Get Free Updates Into Your Inbox

Learn Everything Just Like I Did

SUBSCRIBE



4 comments

  1. Hi Ravi,

    Great information to have. I learned this not too long ago when I changed domains on an old blog. Learning how to do the redirect in .htaccess is awesome, however, was scary too. I don’t like dabbling in those files. ?

    Love the right up. Passing it along. Thanks!

    B

    1. Hey Brenda,

      The file named .htaccess has the solution for many problems. If you want to redirect your blog to any other domain then can do it by putting the code in the .htaccess file. The improvement in the speed of your website can be done using this file.

      Beginners fret to change the code of any file from the cPanel. they should try to handle their website the best way they should.

      Glad to have you here.

      Enjoy the day.

      ~Ravi

  2. Hi Ravi,

    Good post. Lot of people are not aware of the .htaccess file and this information will be very helpful for bloggers who use WordPress. Most notably, WordPress modifies .htaccess file to be able to handle pretty permalinks, which is a very important feature.

    Thanks for sharing!

    1. Hey Arpit,

      Apart from other files of the WordPress, there is a specific need to have the .htaccess file. The changes you can do by adding some code would be remarkable. But newbies are afraid to do such techie stuff. I mean why?

      Enter in the cPanel would be the best decision to enhance the glory of your blog to a new level.

      Thanks for sharing your thoughts.

      Enjoy the day.

      ~Ravi

Leave a Reply

Your email address will not be published. Required fields are marked *