WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] invalid page query shows index page instead of 404 or home page (3 posts)

  1. Andrrew
    Member
    Posted 2 years ago #

    URL /?p=x ,where x is any non-numeric string, results in index.php showing all posts.

    I would prefer it to show my home page (static) or a 404 page as I filter the content depending on user and don't want to show all to all and sundry.

    If the url is for a page not found e.g. /?p=12345678 then response is correctly a 404. However any other /?p=[something] results in index.php showing all posts.

    I am not using permalinks.

    Is this a bug or a feature? If a feature, is there a work-around?

  2. If it starts with a number it goes to 404. If not it goes back to index.php... Interesting.

  3. Andrrew
    Member
    Posted 2 years ago #

    Yes, interesting. I presume this is a core decision, that I don't want to mess with.

    Nope, I've found the answer: I changed the static home page (page-2) template from 'page-2.php' to 'home.php', changed the template link, and now all's well.

    Thanks Ipstenu, for providing unfathomably unconnected inspiration.

Topic Closed

This topic has been closed to new replies.

About this Topic