GRAPES

"We strive to provide Good, Reliable, Advanced, Professional, Enriching & Safe (GRAPES) experience by our products & services"

Fix: 404 page not found error

Fix: 404 page not found error

There are various reasons why the blog pages start throwing ‘404 – page not found error’.  They potentially start to surface post a version update of the either the server which’s running the software like WordPress used for creating blogs or post an update to blogging software itself.  We’ll try to explore some of the most common causes and the potential fixes.  Please note that the options being explored in the post are specific to WordPress which’s open source blogging platform.

There are primarily 2 main reasons for the dreaded 404 error,

  1. The missing ‘.httaccess‘ file in the root directory of the WordPress
  2. Issues with ‘Permalinks’ which’s making the page inaccessible

The .httaccess file:

You need to logon to your WordPress account with your root credentials and access the parent directory of the WordPress.  For example, on a Synology running DSM7.0, the ‘wordpress’ directory can be found under “web_packages’ folder.  Obviously, you would need to login to Synology with admin credentials to access the wordpress folder.  In the folder look for the file ‘.httaccess’ file and if it’s present ensure the contents are as shown below else create a file with the contents matching the below contents.  And ensure to name the file ‘.httaccess’ (notice the presence of ‘.’ at the beginning of the file name).

1
2
3
4
5
6
7
8
9
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

This should resolve the 404 error when you try to access the blog page now.  If it does give this post a 👍, else continue to read..

The Premalinks:

Login to your WordPress using the admin credentials and access Settings -> Permalinks

Settings -> Permalinks

  • The first step to try is to just hit the ‘save changes’ button to save the current settings on the Permalinks page (yes, just hit the ‘save changes’ button without making any changes).  This should trigger the rewrite rules and also create/update the ‘.httaccess’ file if it’s missing or damaged.  And see if this resolves the problem

Saving the Permalinks

  • If the step above didn’t yield the expected result then try to select any other format for the Permalinks other than what you currently selected.  For example, you could change from the format “Day and name” (see picture above) to “Month and name” (say) or a custom format where you could define based on your requirements.  And hit ‘save changes’.  This should address the problem if it’s due to unsupported Permalinks format tag.

Summary:

The above steps should resolve the problem in most of the cases, however, if you still continue to see the issue, you need to seriously look at the database (for example, the ‘Maria db’ if you are using it) is corrupted and needs a repair.  You can use the PhpmyAdmin software to repair the Maria db database if it’s broken.

The issue in one of the cases was that when one of the users migrated form Synology DSM 6+ to DSM 7 and he had custom format selected for the Permalinks.  On DSM 6+, the Permalinks custom format had “index.php” word before the year, month, day & post name tags.  While it worked perfectly fine on DSM6+ but, on DSM7 it started throwing the ‘404’ error.  And the trick/steps proposed above helped (specifically the 2nd step) to resolve the Premalinks issue and bring his website back online.

Please feel free to comment and provide feedback on the post.  Also, write to us if you need any help in fixing the 404 error on your website!

Avatar photo

Amjad

Website: https://blog.al-zakirah202.familyds.com

I'm Amjad from Bangalore in India. I got a Bachelor's degree in Electronics & Communications from National Institute of Engineering in 2004. I currently work as Product & Test Engineer at a Semiconductor Company. I am currently married with 3 kids - fortunate to be blessed with a good wife as well! I enjoy programming and automating things wherever possible. I have presented many papers and delivered talks in technical conferences. Among my hobbies are setting up home servers for media, photo, books and others, language learning, electronic circuit analysis, software development and many more..

Leave a Reply

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