In this tutorial, we will show you how to Create the Default WordPress .htaccess file. The .htaccess is not an exclusive feature of WordPress but it is used in Apache and Litespeed servers.

In most of the cPanel / Cyberpanel based hostings, you’ll get the default .htaccess in the root directory. But the .htaccess file is anyways hidden in the file manager.

In case if you don’t have a .htaccess file or you want to edit it, you can do it with any normal text editor. You can use methods like accessing the file with File Manager, using FTP or by using SSH.

Method 1: Using the File Manager of cPanel.

Step 1. Login to your cPanel account and then locate the File manager.

Step 2. Click on File Manager and go to the root directory of your domain.

In our case, this is the root directory and it is common for all cPanel based hostings.

Step 3. Enable viewing hidden files from the settings in the top right corner.

Step 4. Click on save and you’ll see the .dot files in your directory too. Now check for existing .htaccess file, if you can’t find any .htaccess file, then go ahead to the next step.

Step 5. Create a new file by clicking on + File button on the top.

Step 6. Enter the name .htaccess and click on create a new file.

Step 7. Done, you created the .htaccess file, now you have to put some default code inside it.

For WordPress, the default code is :

# BEGIN WordPress
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Step 7. Open the .htaccess file, edit it and paste the code given above.

Step 7. After copying just click on save changes and done!

Method 2: Using .htaccess editor Plugin

If you want to keep things simple, you can just go ahead and install a plugin to edit the .htaccess file.

https://wordpress.org/plugins/wp-htaccess-editor/

Step 1. Install and activate this plugin on your WordPress website.

Step 2. Click on Edit .htaccess file link.

Step 3. Click on I understand. Enable the editor.

Now you can edit your .htaccess file from here. You can also test the .htaccess file before publishing and in case anything goes wrong you can restore the last backup too.

Conclusion

So, this is how we can create and edit the .htaccess file on WordPress. If you are under Host it Bro network, and facing any difficulties, then you can just open a support ticket and we will help you out in a few minutes. If you are facing any difficulties then drop a comment.

Previous ArticleNext Article

Leave a Reply

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