Newsletters' Links Redirecting to Homepage or 404
You may have noticed or received complaints from your subscribers about links in your newsletter email directing readers to the wrong page. Perhaps the link is redirecting them to your website's homepage or a 404 error page, and this usually happens after changing something to your URL or migrating the database from another server.
MailPoet runs a cron task to check whether the URL of your site is still associated with your API key. In certain circumstances, the URL returned by the cron task is different from your site's URL, and it can even point to your IP or a different domain.
You can find which URL was returned by the key check task in MailPoet > Settings > Advanced tab > Logging > See logs.
If you didn't have logging enabled before, please enable it and wait for the issue to reoccur. After your key deactivates again, please check the logs.
Knowing what URL is returned by the key check will help determine what adjustments should be done in your site config or by your hosting.
As a first step to troubleshoot this, please try the following:
- Go to WordPress dashboard > Settings > Permalinks, scroll to the bottom of the page, and hit “Save Changes” (without making any changes);
- Open the page/post that the link is supposed to be pointing to, and re-save it.
- Send yourself a new test email with a link to that page, and see if it works as expected.
You can also try clearing all your caching from your theme, plugin, server, and CDN like CloudFlare. If you want to clear the cache from the server, please reach out to your host provider support team.
If the problem is directly associated with the Unsubscribe or Manage Subscription links, you can select another random page to be a customized Unsubscribe or Manage Subscription pages in the MailPoet > Settings > Basics tab, save it, and then switch back to the MailPoet Page.
The same goes for confirmation links not working in the confirmation email sent for double opt-in. In this case, you can repeat these steps, but by going to the MailPoet > Settings > Sign-up Confirmation tab instead: