0

I recently found that an older, now disabled plugin that made scheduled posts was creating new posts as pages. I went into the database and changed post_type to post.

The urls then changed to the permalink structure I have for posts:

http://www.domain.com/default-category/this-is-the-post

Whereas the page URL was:

http://www.domain.com/this-is-the-page

My old page URLs, which were shared on social media already, are now generating 404 errors. Most tutorials I find online discuss setting up redirects when the permalink settings themselves are changed and the whole site is affected. I just want to mitigate these few page-to-post URLs.

1

If it's just a few pages, then you could set redirects explicitly for these pages in your .htaccess file (it's located in your WP install root folder), just add following lines on top of the file (you will need to write a rule for every page you want to redirect):

Redirect 301 /this-is-the-page /default-category/this-is-the-post
Redirect 301 /this-is-another-page /default-category/this-is-another-post

as you see the pattern is really simple:

Redirect 301 /old-page-path /new-page-path
1

I've used the Redirection plugin for this.

1

You can use Redirect Plugin for this or you can even redirect all the 404 error to your home page.

For Redirect Plugin and Code, I think you have already received the answer. Now, please find below the answer for redirect 404 error to home page. Paste below code in .htaccess file.

ErrorDocument 404 /404.php

OR

ErrorDocument 404 /404.html

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.