• Resolved liberto_io

    (@liberto_io)


    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter liberto_io

    (@liberto_io)

    Any idea?

    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. https://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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with 404.php’ is closed to new replies.