How To Fix Error 404 & Empty Cart After Migrating WP Site

Before you start making any changes, make sure you have a full backup of your site. It will save you a lot of headaches. Next, make sure you are on the latest WP version and plugins updated to the latest version. Sometimes, just updating to the latest versions is all you may need to do to solve errors.

Website migration is sometimes necessary and when you do, it is everyone's wish that everything goes smooth. Sometimes, this is not the case and you may run into some challenges including error 404 pages and empty cart at checkout.

Here is how to correct error 404 page after migrating your WP site

Alternative One

Error 404 happens due to misconfigured urls. All you need to do is refresh the urls.

Navigate to Settings » Permalinks then select custom structure and enter /%postname%/ in the text box then save changes. Visit the pages that were showing the errors to check whether the error has been solved. You can then select your preferred permalink structure and save.

Alternative Two

If the step above did not solve your errors, you need to consider this other alternative.

  1. Login to your cPanel or FTP and go to the root directory of your website.
  2. Once in, navigate to File Manager » public_html » your websites root directory.
  3. Find the .htaccess file and rename it to .htaccess_old.
  4. Create a new file and name it .htaccess then add the code below into it.
# BEGIN WordPress

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

# END WordPress

5. Save changes and visit the pages that previously showed the errors. This should solve it.

 

Here is how to solve empty cart at checkout after migrating your WP site

Sometimes, refreshing the urls as we just did in alternative one of the previous step will solve the empty cart issue and you may not need to make other changes. However, if the problem persists, consider the following alternatives:

Alternative One

Check whether your website urls are consistent. Go to Settings » General and check if the WordPress Address (URL) and Site Address (URL) are served from your preferred url. If your site has SSL installed, make sure to use https protocol.

Alternative Two

The next culprit is the caching plugin you are using. Try disabling the caching plugin and try accessing the checkout page after adding items to cart. If the error has disappeared, then caching is the issue.

The cart and checkout pages should not be cached because the information on these pages change frequently.

To exclude these pages from caching, go to the plugin settings and add the cart and checkout page urls to the excluded urls sections. If you are using lscache, just add /cart/ and /checkout/ URIs to the excluded URIs box then save.

Sometimes, the caching problem may persist due to server side caching. In this case, you need to contact your host to exclude the two pages from active caching.

If the problem did not clear, then you may need to consider the next alternative.

Alternative Three

By default WP has admin-ajax.php file which is actively used in shopping carts. Sometimes, the security plugins used on websites may block this file. Try disabling security plugin and check if the error clears.

Alternative Four

If your error has not been cleared so far, it is likely that the new host does not support PHP sessions. You may need to instruct your cart system to use an alternative browser session tracking supported by the host.

Navigate to File Manager » public_html » your websites root directory and find the wp-config.php file and add the code below into it (for EDD cart).

define( 'EDD_USE_PHP_SESSIONS', false );

Paste the code just above the /* That's all, stop editing! Happy blogging. */ line and save changes. This should solve the problem.

Enjoyed this article? Stay informed by joining our newsletter!

Comments

You must be logged in to post a comment.

Related Articles
Author

Leveraging the power of tech to influence human behavior through positive vibes. Get paid to write about tech, science and more.