How to reset or regenerate the .htaccess file in WordPress?

A [.htaccess] file is a configuration file that tells your server how to handle certain things on your website. Like how to deliver web pages, redirect users, password-protect the admin area, protect some directories, etc.


Make the File Visible


The [.htaccess] file remains hidden by default. Follow these instructions to make it visible:

  1. Go to cPanel > File Manager.

  2. Click "Settings" from the top right corner.

  3. Check mark [*] "Show Hidden Files (dotfiles)"

  4. Click "Save".

  5. Done.

The [.htaccess] file is usually located inside the [public_html] directory of your primary domain. If you have any additional domains, you will find them inside their respective directories.

 


Regenerate or Refresh the File


Make sure to take a backup of the original [.htaccess] and [.user.ini] files before regenerating them.

 

Get Current Permalink Setting:

  1. Go to WP Admin > Permalinks.

  2. Note the currently selected option.

  3. Done!

 

Rename the Files:

  1. Go to cPanel > File Manager.

  2. Rename the [.htaccess] file to [bk-htaccess].

    Select the file and click "Rename" to rename it.
    Do not delete the file in case you need it later.

  3. Rename the [.use.ini] file to [bk-user.ini].

    *Your website might not have the file.

  4. Done.

 

Regenerate the File:

  1. Go to WP Admin > Permalinks.

  2. Select a different permalink option.

  3. Click "Save".

  4. Select the original permalink option.

  5. Click "Save".

  6. Done.

  • 311 Users Found This Useful
Was this answer helpful?

Related Articles

How to fix the 403 forbidden error in WordPress?

In this article, we will show you how to easily fix the 403 forbidden error in WordPress. What...

How to deactivate plugins when not able to access WordPress admin?

Often during troubleshooting, you may need to deactivate all plugins and activate them one by...

Fix incorrect PHP handler or session path

  Server software and configuration can vary from provider to provider, which in turn causes...

How to fix errors after migrating WordPress?

  Migrations from cPanel-based servers are usually seamless. But sometimes, a few issues might...

Fix missing MySQL extension or PHP extension or session error

  The most common reason for the error is using an invalid PHP handler/directive in the...