23 Jul 2020

How to Fix WordPress Page Returning 404

How to Fix WordPress Page Returning 404

WordPress bloggers often encounter this issue, when they see their previous post returning a 404 not found error. It could be the Home page or an internal link that should redirect to some page within your site. The page could belong to a website that’s your sister-concern as well! Now we can all guess how embarrassing and panicking it could be for the website owner to have this error live on his or her site! Don’t panic. The solutions are simple when you can take the help of a WordPress maintenance service provider to fix it or you can do it yourself. This article provides you with all the possible ways in which you may go about resolving your error…

“404 error” – What does it mean?

All internet users are acquainted with this. It commonly occurs when you hit on an internal link and the website returns with this “404 error” notice on the screen. It’s annoying and hugely disturbing as well. Especially, if you are surfing your own website (for whatever reasons), a 404 error is as exasperating as losing your internet connection in the midst of uploading your blog!

Before entering into ‘how to fix the error’ a fair concept of what gives rise to these errors is necessary. For WordPress blogs, the ‘404 Not Found’ error is the most commonly found error. This error shows up on your screen due to either of these two backend issues –

  1. Correct the Permalink settings
  2. Rewriting rules in the .htaccess file

The issue resolves may, therefore, take 2 separate paths. They are –

  1. Modifying your .htaccess file

Let us begin the discussion with “what is .htaccess file?” That would help my non-technical readers and WordPress beginners aptly!

A .htaccess file contains ‘directives’ which are instructions to tell the server how to behave in response to different conditions and your website in the frontend behaves accordingly. Such two directives are ‘Redirects’ and ‘Re-writing URLs’. Different CMS such as WordPress, Joomla, Magento, Drupal may also add directives to the .htaccess file for those scripts to modify the function of your website.

Modifying the .htaccess file can be done in more-than-one ways. Precisely, they are –

  1. You can edit the file on your computer and upload it later on to the server via FTP (we thrust upon the use of FileZilla)
  2. FileZilla’s (or your FTP program’s own edit mode can be used as well
  3. Using SSH (to remotely and securely access the client-server) and using a text editor
  4. Using the File Manager in the cPanel

Fixing WordPress errors is both an interesting and one of the most researched topics on the internet too. The section above only mentions the different ways of editing the .htaccess file! As this article assumes its readers to be only a beginner with the backend processes of WordPress, the discussion needs to be a little more detailed.

A glimpse of how the editing is done on SSH or using the cPanel’s File Manager…

How does SSH protocol work?

SSH stands for Secure Shell. When the remote computer runs on the SSH server, you can have access to it. That can be utilized for purposes like file transfers, carrying out commands, etc. The mostly-enquired thing is: how secure is SSH?

SSH is known for secure remote login from one system to another. Security is ensured through strong authentication and encryption. You are now equipped with alternatives to non-protected login protocols like the rlogin or any insecure file transferring protocol like FTP!

The working process…

This protocol works in a client-server model; the SSH client connects to the SSH server. A connection setup process is driven by public-key cryptography. The identity of the SSH server is thus verified. Once this setup phase is over, the privacy of data that is exchanged between the client and the server is ensured through strong encryptions and hashing algorithms.

How to edit using cPanel’s File Manager?

  • Your first step here should be ‘backup’. Backing up your website unloads a lot of stress and you can always revert if something goes wrong midway!
  • Now log in to cPanel
  • Open the File Manager from the ‘Files’ section.
  • Now click on settings on the topmost right-hand corner of your screen. Select the domain that you need to access, from the drop-down menu. This helps you to change the document root.
  • Ensure that the ‘Show Hidden Files (dotfiles)’ is checked.
  • Click on Save.

From the list of files access the .htaccess file and continue with the following steps:

  • Right-click on the .htaccess file and go to the Edit menu. A dialogue box will be appearing alarming you with a question on encoding.
  • Click on ‘Edit’ to open the editor in a new window
  • You may paste codes from the second line in the .htaccess (To add new codes an extra line should be there.)
  • Once you are done click ‘Save Changes’ on the upper right-hand corner of your screen

Exit the File Manager menu by simply closing the window. Wait, your fixing-the-error job is not yet complete! Test your website if all the changes have been made live without any errors. If not, you either need to resolve it immediately or revert back to the previous version once again.

Hopefully, this article will be fruitful enough and not leave in a situation of reverting!

  • Correct the Permalinks Structure of your WP site

This is your second and most probably the more favorable choice for re-doing your 404 Not Found Error. You are only required to apply the following steps –

  • Login to the WordPress Dashboard
  • The left navigation menu displays the ‘settings’ icon. Click on Settings -> Permalinks -> select ‘Default’
  • Save your settings

You only need to keep in mind that is a custom permalink structure is being used, that needs to be copied and saved somewhere.

In most cases of returning-404-error, updating the permalink status resolves the issue. Maximum cases of 404 Not Found are due to the .htaccess file getting deleted or something going wrong in the rewrite rules. Setting the permalink structure to default status usually flushes the rewrite rules. However, if you are not comfortable with adding codes manually, it is recommended to consult with a professional WordPress maintenance company.

What if you don’t want to manually add codes to your .htaccess file?

Here’s the solution…

  • Login to the server using FTP.
  • Usually, files like /wp-content and /wp-includes are present in the same place as the .htaccess file.
  • Make this file temporarily re-writeable by changing the permissions to 666! After this, you can go ahead by repeating the original solution.

The only risk is that you might forget to change the permissions back to 660. Well, this article comes to tell you that you cannot afford to forget that!

Leave a Reply

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