You may have experienced error 404 before. In some cases, your main page is still accessible. Even when you check ID number, everything is working perfectly. This error may come back to caching rules.
There are unique rules for the cache. When these rules aren’t updated, these issues could occur. In fact, the main problem is with the permalinks. These links are designed for better readability. Although sometimes they can cause problems.
But you don’t need to worry about it. This issue is simply fixed when you flush permalinks. There are many ways to fix this issue. However, it all depends on your accessibility to WordPress and backend.
What Are Permalinks and How Do You Flush Them?
One of the built-in features in WordPress is the ability to use permalinks to increase the readability of your URLs. By default, after changing permalinks, WordPress deletes your cache.
As mentioned above by resetting your permalinks you can keep your cache rules updated.
How to Flush WordPress Permalinks?
In this tutorial, we will teach you how to reset your permalinks in three different ways. Through WordPress dashboard, phpMyAdmin and PHP code.
1. Flush WordPress Permalinks in WordPress Dashboard
Head over to your WordPress dashboard. From Settings, click on permalink. Then, click on Save Changes.
This will reset your .htaccess file. If this method doesn’t work, you need to go through the next solution.
2. Flush WordPress Permalinks with PHP
To flush WordPress permalinks, you need to copy and paste the code below to your functions.php file:
Although, this code makes the process happen constantly. So it may prove to be costly. It’s best to look for alternative ways to run the file. You can use a hook in your PHP code for example.
3. Flush WordPress Permalinks Through phpMyAdmin
The last method is by accessing the database and phpMyAdmin. Resetting WordPress permalinks in this method requires time and focus.
Generally, you need to delete specific values from a specific field. We do this through the backend.
Before starting, you need to get a backup of your database. To access your database, head over to your cPanel and click on phpMyAdmin from the Database section
Keep in mind, a simple mistake in this section could completely destroy your WordPress website.
After logging in to phpMyAdmin, from the main page, click on the SQL tab. Copy and paste the code below in the code section:
SELECT * FROM ‘wp_options’ WHERE ‘option_name’ = ‘rewrite_rules’
To run your command, you need to click on GO. By clicking on Edit, you view all the editable fields. Look for Option_value column. Codes in this field are sorted based on alphabet and numbers.
By deleting these codes, you flush your WordPress permalinks and by revisiting your WordPress, new codes are generated.
In this tutorial, we talked about three main ways to flush WordPress permalinks. We started with the simplest method and finished with phpMyAdmin which is the advanced method.
We mentioned getting a backup is necessary for this process. You always need to get a backup your WordPress website when you are going to make changes to phpMyAdmin.
By following the steps above, you can fix error 404.