How to fix the 404 errors in wordpress

→ Are you a new visitor? Please visit the page guidance for new visitors ←

How to fix the 404 errors in wordpress

When moving website to one server to another, or reverting back from a backup, it will happen for you to encounter 404 errors due the the fact that the .htaccess file is missing, the one that contains the rewrite rules for your permalinks settings. So how to fix 404 errors on wordpress in this case?

The solution is fairly simple, it involves recreating the rewrite rules for your permalinks to work. You have two options to fix this, using wordpress backend or manually creating the .htaccess file.

  • Reset permalinks from wordpress wp-admin section

you just need to login to your wordpress backend, and navigate to: Settings –> Permalinks:

Permalinks settingsAnd then hit save changes. Test your website and the pages and article links should work properly as expected.

You can also customize the permalinks settings with more options, adding variables from the following list:

  • %year% – The year when you wrote the article, in four digits, for example 2012
  • %monthnum% – The month of the year you published the article, in digits, for example 10
  • %day% – This would be the day of the month you published the article, for example 30
  • %hour% – The hour of the day when the article was published, for example 14
  • %minute% – The minute of the hour when your article was published, for example 30
  • %second% – The second of the minute when you published the article, for example 20
  • %post_id% – This is the unique ID # of the post, the one from your database, for example 254
  • %postname% – This is a sanitized version of the title of the post (post slug field on Edit Post/Page panel). It will transfer the article title “This Is My First Article!” to this-is-my-first-article in the URI.
  • %category% – This is a sanitized version of the category name (category slug field on New/Edit Category panel, if more category it will pick the first one alphabetically). Nested sub-categories appear as nested directories in the URI.
  • %author% – This will be the author of the article, the person who was logged in wordpress when you wrote and published the article.

As you can see, you can use quite a few options, however I personally recommend using the option:


I believe it will be far better for SEO, as search engines always love new content for your main domain name.

  • Creating the .htaccess file for permalinks

Another option how to fix the 404 errors in wordpress is by creating the simple .htaccess file with the default rewrite rules for wordpress. Resetting the permalinks like explained above will create the .htaccess file for you automatically, however in case wordpress can not create the file for you, it will tell you the contents that need added to your .htaccess file.

By default, these are:

Create the .htaccess file using your favorite editor or Filemanager and upload it where your wordpress index.php file is located.

And you are done, if you have any issues, please leave a comment.

  • Thanks for this guide, I found it quite useful.

    • You’re welcome, glad you find it useful.

Request an article ←