1

I moved a wordpress directory from "http://example.net/wordpress" to "http://example.net" and now the home page is giving a 404 error.

Every other page is working correctly, AFAIK. For example, "http://example.net/about" displays correctly, but entering "http://example.net" into the address bar eventually resolves to "http://example.net/wordpress" and then gives a 404 error.

In the database, I changed the values for site URL and home URL to be correct.

The page that should be displayed is page_id=6. In the database table for "wp-options", the option for "show_on_front" is set to "page". The option for "page_on_front" is set to 6. (I didn't change these values)

Typing in "http://example.net/?page_id=6" gives a 404 error but typing in "http://example.net/?page_id=416" goes to its correct page.

I set permalinks to "plain" (so no permalinks). In the reading options I set the home page to show blog posts (instead of a static page). When I do that, the site url with ?page_id=6 resolves correctly.

If I then change the reading options to use "Home Page" for the front page, When I do that, the site url with ?page_id=6 resolved to the correct page but the site address resolves to "example.net/wordpress" and shows the correct page.

I turn the permalinks on and the site url resolves to "example.net/wordpress" and gives a 404 error.

If I use a different static page for the home page, the same thing happens.

  • When moving WP you need to use a database migration plugin. Setting those two WP options is not enough; WP stores the URL in many places throughout the database, many of them serialized, so if you try a simple search and replace it will fail. Using a plugin to replace everything and adjust serialized counts will clean it up, just be sure to also clear your browser cache after completing this so you don't see cached redirects that are no longer actually in effect. – WebElaine Mar 13 '18 at 15:52
  • Did that with the Velvet blues plugin. The links / assets / graphics are all fine. Just one page (the home page) is 404-ing with permalinks on. – Rev. Samuel Mar 13 '18 at 16:05
  • 3
    Solved it myself: There was a folder that I was using for home page assets, the address was "example.net/home/" and the original WP development was "example.net/wordpress/". When I moved the wordpress files out to the root, the home page had a slug of "home" that now conflicted with that "example.net/home" folder. To fix this, in the Reading Options, I changed the home page to show posts. Then I changed the slug of the home page to "home-page". Then I set the home page to show the static page "home-page" and now everything is working. – Rev. Samuel Mar 13 '18 at 21:50
  • @Rev.Samuel Glad you managed to resolve this. You can add that as an "answer" (and later accept it). This would also remove the question from the unanswered question queue. (Comments are just that; "comments" and are not meant for "answers.) – MrWhite Mar 13 '18 at 23:55
0

TL:DR: The slug of the home page and a folder at the root had the same name

There was a folder that I was using for home page assets, the address was "example.net/home/" and the original WP development was "example.net/wordpress/". When I moved the wordpress files out to the root, the home page had a slug of "home" that now conflicted with that "example.net/home" folder. To fix this, in the Reading Options, I changed the home page to show posts. Then I changed the slug of the home page to "home-page". Then I set the home page to show the static page "home-page" and now everything is working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.