The .htaccess is an essential core file within WordPress. In essence it enables permalink functions, you can also customise your .htaccess file to carry out many other things from speeding up your WordPress site, to security and performing redirects.
The essential configuration file used on an Apache server can be found in the ‘root’ section of your account.
The essential code for your .htaccess file necessary for WordPress is as follows:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Firstly login to your cPanel account using either through the client area or using your login details.
Once logged in go to Files --> File Manager
Then double click the public_html directory
The default setting within cPanel is that all dot files are hidden. Therefore, if you don’t see the htaccess file you will need to check the file is not hidden. To do this:
Click Settings (top right hand corner)
This brings up the ‘Preferences’ dialogue box. Just select the checkbox ‘Show Hidden Files (dotfiles)’. Then simply click ‘Save’ and the page will reload, and it should now display your .htaccess file.
If you have migrated your website from another host to Cheap Host and for some reason you are missing the htaccess file, you will need to create it to ensure your WordPress installation works correctly.
From within your cPanel account in the public_html directory:
Select ‘+ File’ in the top left of your screen
And then type .htaccess and ‘Create New File’
The page will then reload, and you will see your htaccess file has been created. It will usually be directly underneath the ‘wp-includes’ folder.
If you want to then add the necessary WordPress .htaccess code at the top of the page simply highlight the .htaccess file using the left mouse button and click ‘Edit’ from the top menu options. Click ‘edit’ again when the dialogue box appears and then copy 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 simply click ‘Save Changes’ at the top right hand corner of the page, and that's it all done!
One of the most common causes of a ‘404 error’ after moving your website to Cheap Host, is that your .htaccess file is now. missing from your installation. This is because the .htaccess file controls the permalink structure within your website, and so the homepage may load, but you will get the 404 error when you try to load another page within your website. If you get this error, please follow the instructions above to ‘Create a New .htaccess file’ above.