Skip to content

You are here: Home / kb / How to Configure your .htaccess file for WordPress

Knowledgebase Guide

How to Configure your .htaccess file for WordPress

The .htaccess file is an important WordPress file used for permalinks, redirects and other Apache server rules.
This guide explains how to find, create and update your WordPress .htaccess file inside cPanel.

Important: The .htaccess file is usually a hidden file. In cPanel File Manager, you may need to enable
Show Hidden Files (dotfiles) before it appears.

Default WordPress .htaccess Code

The essential .htaccess code normally used by WordPress is shown below:

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

Locating Your .htaccess File in WordPress

Firstly, log in to your cPanel account either through the client area or by using your cPanel login details.

  1. Log in to cPanel.
  2. Go to Files.
  3. Select File Manager.
Select File Manager in cPanel

Then double click the public_html directory.

The default setting within cPanel is that dot files are hidden. Therefore, if you do not see the
.htaccess file, you will need to check that hidden files are enabled.

  1. Click Settings in the top right-hand corner.
Settings in cPanel File Manager

This opens the Preferences dialogue box. Select the checkbox for
Show Hidden Files (dotfiles), then click Save.

The page will reload and should now display your .htaccess file.

Create a New .htaccess File in cPanel

If you have migrated your website from another host to Cheap Host and your .htaccess file is missing,
you may need to create a new one so that your WordPress permalinks work correctly.

  1. Open cPanel File Manager.
  2. Go to your public_html directory.
  3. Select + File in the top left of the screen.
Create a new file in cPanel
  1. Type .htaccess as the file name.
  2. Click Create New File.

The page will then reload and you should see that the .htaccess file has been created.
It will usually appear directly underneath the wp-includes folder.

.htaccess file in cPanel File Manager

Editing the .htaccess File

To add the required WordPress .htaccess code, highlight the .htaccess file using the left mouse button,
then click Edit from the top menu options.

Click Edit again when the dialogue box appears, then copy and paste the following code:

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

Now click Save Changes at the top right-hand corner of the page. That is all done.

404 Error in WordPress After Site Migration

One of the most common causes of a 404 error after moving your website to Cheap Host is that the
.htaccess file is missing from your WordPress installation.

This is because the .htaccess file controls the permalink structure within your website.
Your homepage may load correctly, but other pages may show a 404 error.

Tip: If your homepage works but inner pages show 404 errors, recreate the .htaccess file using the WordPress code above.

Still Having Problems?

If you are still having problems with your WordPress .htaccess file, please sign in to your hosting account and open a support ticket.
Our team will be happy to help.


Open Support Ticket