.htaccess file is one of the most important system file. Which resided in the root directory of hosting. In this article I will be discussing most of the things which you need to know about htaccess file like foremost. I will be answering how to create and edit htaccess file in WordPress.

You might be aware htaccess file of wordpress can be created manually through c panel. You may not be knowing that you can edit this file right in your wordpress dashboard. I will tell you most of the possible ways to do this by plugin or with the help of FTP client filezilla. What you have to do walk along with me I will make as simple as I can for you.

What is htaccess file

This file is it attached to Apache server and it is a configuration file, which creates a bridge between your blog and server. And it communicates with server to behave for your blog as per the rules and instructions are given in the htaccess file. The dot at the beginning of file name denotes it is hidden file. You have to turn this feature on as before you cannot edit this file. You just need to turn on this then you can open this file using FTP client filezilla and c-panel of hosting.

create and edit htaccess file
How to create and edit htaccess file in WordPress

How to create htaccess file in WordPress blog

htaccess file is automatically created in WordPress when you click on save to your permalink settings.

edit htaccess file in WordPress

There can be some scenario when this file is not created maybe some permissions of your hosting. Which restricts this but in that case you need not to be panic it can be created manually. This tutorial will help you to create htaccess file manually.

Steps to create htaccess file manually in your wordpress blog


First you have to create a text file on your PC. Paste the given code in that file now. What you have to do is to rename this file from .txt to .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Now switch on to file manager in your c panel. And upload this file to the root directory of your blog and paste the code in the file which we have discussed.

How to edit htaccess file in WordPress blog

These are the ways through which you can edit htaccess file. Like through cpanel in your hosting.
Access cpanel then navigate to file manager in your cpanel dashboard of your hosting account.
You can find public_html this is where htaccess file is located or in root directory. Right click on htaccess file and click on edit and simply you can edit this file and resave.

  • There are many hosting providers which are restrictive and do not let make changes to files. In that case i would tell you buy hosting before doing due research of that. In case if you want free hand and amazing support you can give a try to Hostgator.

Edit htaccess file in wordpress through yoast SEO plugin

This is widely used SEO plugin and you all might be aware of that. And you might be using it too. But here at this blog we are using rank math SEO by mythemeshop.

create and edit htaccess

In your yoast SEO plugin settings click on edit files then you are good to go.And use the provided code and save changes to htaccess.
You should take a backup of your blog before changing or editing htaccess file. sometimes you can break your site this will be great saver.

Do let me know in the comments if you are not able to change your htaccess file I will be more than happy to help you