How to check and Fix .htaccess File in WordPress?

FIx and check .htacess file | WordPress error

A corrupt .htaccess file can cause several errors in WordPress. The most common error caused by corrupt .htaccess is 500 internal server errors. So, In this post, we are going to check and fix .htaccess file in WordPress.

Before proceeding further, take a backup of your WordPress website so that if something goes wrong we can restore the WordPress website again.


What is .htaccess file in WordPress?

The .htaccess file is a configuration file used on web servers running the Apache Web Server software. It’s a text file that contains important server instructions.

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP_REFERER} website1.com [NC,OR]
 RewriteCond %{HTTP_REFERER} website2.com [NC,OR]
 RewriteRule .* - [F]

credit: sitepoint.com

Why .htaccess file is important?

The .htaccess file is used to enable/disable functionality and features in the Apache Web Server. Which includes password protecion, content protection, deny website access to visitors, redirection, and much more.

It can also contain additional information and instructions depending on the applications installed on your apache web server. It allows designers, developers, and programmers alike to edit or change the configurations of the Apache Web Server in order to provide more functionalities.

How to access .htaccess file in WordPress?

The .htaccess file can be found in the root directory of WordPress files with other files like wp-admin, login.php, etc. Follow the given instructions below:

  1. Log into cPanel.
  2. Now, Go to File Manager.

There are you find your all files of WordPress including wp-admin, wp-content, etc. If you are unable to locate .htaccess file in the WordPress files directory then it may be hidden. So, you have to change settting of your file manager to see hidden files.

Fix and check htaccess file in WordPress

Now, you can see .htaccess in ftp client or in your root directory if you are login into your cPanel account.

How to fix .htaccess file in WordPress?

The .htaccess file can be corrupted due to many reasons for example, if some plugin is being installed or if a file is not configured properly, even sometimes if the internet connection drops out while things are being written to your server. So, there may be many reasons which can cause .htaccess file to be corrupted.

Follow these steps given below to check and fix .htaccess file in WordPress:

  1. Log into your cPanel.
  2. Navigate to File Manager and rename .htaccess file like .htaccess to old_.htaccess. Now check whether your WordPress website is back again to normal. If yes, then .htaccess file was corrupted.
  3. Now, delete the old_.htaccess file.
  4. Go to the admin area of your WordPress website then navigate to setting >>Permalinks >> save changes.

You don’t need to change any Permalink settings. Resaving your settings will generate a new .htaccess file on your server automatically. To check this, go back to your server and refresh the screen, You should see the new .htaccess file in your server directory.

Be the First to comment.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.