How To Edit WordPress .htaccess File

How to Edit .htaccess in Wordpress_

Out of the many reasons why people choose WordPress over others, editing at the core level is the best reason. You can explore all option to know about them and then edit it at your will. One of them is .htaccess. now you have heard about it and maybe try to search for it but you didn’t find it. so in this article, we will share How To Edit WordPress .htaccess File.

What is a .htaccess file?

Now when you see the file name, you may have noticed the period sign in front, that means the file is hidden. The full name is Hypertext Access. This file helps you edit directly from the root file. It’s not just for WordPress only, its also for Apache web hosting. The default code for .htaccess would look like this:

# BEGIN WordPress

RewriteRule ^index.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

# END WordPress

Now there is the reason why this file is always hidden, because changing this file would affect your whole website and if you make any mistake, the result would be crashing of your website. You can do lots of thing like protecting your images from hotlinking, redirecting URLs, preventing access to site folder or blocking IPs from accessing your site.

How to Create .htaccess?

Now, most of the time, you will find it that file hidden in your root directory but if you don’t find it, you can simply create it. you just need to create a text file with the name of .htaccess and save it. then you can upload it to the server through cPanel or FTP client

How to Edit .htaccess?

You can edit it by three different ways

  • cPanel .htaccess edit
  • WordPress Dashboard .htaccess edit
  • FTP Client .htaccess

Now we will explain it every single one so that you can edit it as the way you prefer.

How to edit .htaccess with cPanel?

If you have a self-hosted website than you know what is cPanel is. It’s easy to use and easy to edit everything with it. so now when you open your cPanel, you just need to find the .htaccess file. For that you need make sure that its show hidden file mode is on.

You need to find the folder where you saved your WordPress files and that’s is where you can find .htaccess file. Now you just need to open and edit it.

Important: make sure to take a back up by copying the file and save it somewhere as if you edit it in wrong way, your website might suffer from it and then you will find that back up useful.

How to edit .htaccess with WordPress Dashboard?

WordPress dashboard is one of the cleanest and sophisticated dashboards you ever came across. You cannot edit .htaccess file directly from WordPress but you need a plugin to do that.

There are two plugins which might be useful to that,

  • SEO by Yoast: you can simply open Yoast SEO and go to edit files to find .htaccess and edit it.
  • WP Htaccess Editor: you can download this plugin, which equal is useful and one of the best features is, you can actually take a backup. So that if something goes wrong, you can restore it.

There is no inbuilt editor from where you can edit that file from WordPress that why you can download SEO by Yoast or WP Htaccess Editor and edit it. you can also explore for many other plugins which is available.

How to edit .htaccess with FTP?

FTP is file transfer protocol client like FileZilla or Cyberduck from where you can edit that file. You need to login to FTP hosting account and then find the file to edit it. here is how you can do it with FileZilla.

  1. You need to open the FileZilla menu options
  2. Select the server from it
  3. Force showing hidden files
  4. Find the .htaccess file and then edit it.

You need to download the file and then edit it. you can use your default editor which comes with windows or Linux or any OS and then edit and simply upload it back. Make sure that the permission of your .htaccess file is 644 and not 777.

The technics are simple and easy to use, and you can accomplish so much from it. I hope this post is useful to you, if you have any question, do let us know.


Related Posts