Blog Redirects Affecting 404

  • So, I'm rewriting URLS to make blog posts more friendly. The redirects work fine with one exception, I can type url/blog/anything-that-is-not-a-real-post and I don't get a 404 returned but instead an empty post. Top level pages(i.e. url/anything-that-is-not-a-real-page) all return the 404 error. Redirects to actual posts and archive, category, tag pages all work fine.

    Below is my .htaccess configuration. I'm not sure what may be affecting what in terms of the blog redirect, so hopefully someone can help.


    Here's my settings:

    perch-settings.png

  • drewm

    Approved the thread.
  • A blog post is not a page. So on post.php you need to determine whether the slug from the URL matches a real blog post and proceed accordingly. This means your post.php page should respond with a 404 status code if the post is not found.


    See the post 404 Response which details how you can programmatically respond with a 404 on standard Perch and on Perch Runway.


    In your case, it would be something like this: