WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Problem with 404.php (3 posts)

  1. liberto_io
    Member
    Posted 1 year ago #

    Hello,

    My theme include a 404.php template file. but when I search something that doesn't exist using default WordPress search engine, I encounter index.php with no post. What should I do if I want to redirect URL to 404.php template?

    I'm running WordPress on a local host. Don't have a search.php template and I have added code below to .htaccess

    ErrorDocument 404 /wordpress/index.php?error=404

  2. liberto_io
    Member
    Posted 1 year ago #

    Any idea?

  3. WPProHelp
    Member
    Posted 1 year ago #

    The 404 error page does not show up when you search for something that does not exist. That only works when someone requests a URL directly which does not exist.

    E.g. http://www.test.com/1234

    If that URL does not exist and you request it, the 404 page is triggered.

    If you want to show something when search does not find anything, you have to modify the search output.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags