WordPress site which beliefs on many important ‘core files’ to do its job and one of them is the .htaccess file. It performs only certain functions that are related to your website’s permanent links as default,  by redirecting visitors to your site or improving your site’s security you can add and customize all sorts of useful functions.


It is a .htaccess configuration file which is read by the server
It is used to revoke the many many server configuration settings and it is also used for authorization, cache control, website optimization, and URL rewriting.
  • Apache uses this file to manipulate how it presents files from its root directory and its subdirectories. Most importantly, WP modifies this file to handle beautiful formalin.
  • .htaccess file is mostly used for rewriting URLs, making them cleaner, and more readable by users and search engines in WordPress

.htaccess file handles one major task  in WordPress(default)

  • It controls the permanent links on your site. 
  • If you change your Permalink configuration, the .htaccess file updates new instructions for the server. 
  • You have to customize your permanent link to create your .htaccess file.

It is also used to make various changes to your site’s functionality, 301 redirects in the .htaccess file, tighten security by restricting access to your site and other core files.

Some plugins additionally add their rules in your .htaccess file to help the plugin function, this is for temporary savings or for Security.

To find and make changes to the .htaccess file in WordPress You don’t need to understand all the technical details.

What you can do with the .htaccess file in WordPress

A major important thing that we have to do first in that process is understanding how to use the .htaccess file in WordPress.

For accessing the .htaccess file in WordPress, you have to make a direct connection to your website using the File Transfer Protocol (FTP).

There are a lot of things you can do in this file – things that cannot be hidden in a post. Although, let’s see some examples to get you started.

Initially, we will see about redirects. You have to automatically direct users who visit your old URL to your new location in case if you have to move your page or post or maybe your entire website.

For redirecting a single page, you can add this line to .htaccess file at the bottom

Redirect 301 /oldpage.html

With the pages of old permanent link replace it by a /oldpage.html and follow the URL with its new link of the page. Even you can add a new line for each and every page that you would like to redirect.

You can also redirect your entire website by using similar snippets, otherwise, you can able to use the snippet to send all traffic to your website to secure your HTTPS version, this is possible only if you are having an SSL certificate.

The .htaccess file also helps you to make several security-related changes to your website. For example, For restricting the unauthorized user’s to access your several important core files you can add the below code

<FilesMatch “^.*(error_log|wp-config\.php|php.ini|\.[hH][tT][aApP].*)$”>

Order restrict, allow

restrict from all


For additional learning about to improve your website security using the .htaccess file, you can refer to the WordPress Codex entry in this case. Remember to back up your site and use the forum environment when attempting any changes in your site.


To become a WordPress expert its important to learn work directly with your website files and it is a very important step in your learning journey. Although .htaccess can be used for several different applications it is really a good place to start because why I’m saying this is, it’s a relatively simple common file to work with.

Before making any changes to the .htaccess file in WordPress by yourself, confirm that you have taken a backup of your site and use a staging environment. If that has done, then you can access your site by using FTP, find and edit the .htaccess file on your website. Once you found how to perform it, you can find the code you need to add the functions you need.

Previous post How to increase website traffic
Next post The Best Contact Form Plugins in WordPress

Leave a Reply

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