Every time I start a new blog, I start from scratch in a live server.
Finally, I installed AMPPS in my desktop (Windows 10). This setup should boost my productivity . . . until I discovered an error.
After moving my blog from local hosting to a server, I started posting blog post.
The Issue: Whenever I preview the draft, the page return a 404 error (page not found).
How am I suppose to see what my publish post will look like? This is the first time I encountered this issue.
The Cause: I changed the permalink of the WordPress blog in the local hosting.
It’s either I would avoid changing the permalink in local hosting or change the AMPPS setting which I am yet to find out.
How to Fix the WordPress Preview 404 Error
Without editing the code, this error could be fixed. I tried two solutions; the second fixed the issue. You may have to do both to see what works on your blog
Solution #1
- Go to WordPress dashboard > Settings > Permalinks.
- Choose Plain (or other choices) under Common Settings. then save.
- Choose the permalink format that you want then click save. I chose Post name.
- Preview a post in a draft to see if the error is fixed.
That’s how simple it is.
If this didn’t work like in my case, try the next solution which is something I tried out of the blue.
Solution #2
My blog’s url has https:// done through Let’s Encrypt. When I moved my blog in the server the URL has http:// instead.
- Go to WordPress dashboard > Settings > General.
- Check the WordPress Address (URL) and Site Address (URL). I changed the http:// to https:// then save.
- Follow the steps in Solution 1.
This solved the issue in my case. I stopped seeing 404 Error whenever I preview a draft.
Related: How to Install WordPress in a Directory (in a Different Folder)
The important thing to remember is to be consistent with the URLs.
Whether you are still using http (really, why?) or https, make sure that the URLs in General Settings matches in Permalinks.
And use https. It’s easy and free to set up with Let’s Encrypt. Check your hosting if it’s available or use a similar feature paid or free. Encrypt your site no matter what.
Having the same issue? Did it work or were you able to solve the issue with different solution?
Leave a Reply