Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How do I leave the URL in address bar when the page goes to the 404?

I am trying to design a website and I have it mostly in place but the one thing I haven't sorted yet is how to keep the url in the address bar if the page goes to the 404, which tells them to check what they typed in.

I know I can do it with frames if I want the whole site to do it but I want it to stay as "websitename.com/typedurl.htm" rather than "websitename.com/404.htm"

Any ideas anyone?

3 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    You can not because you are designing the wrong thing. You need to design a browser or browser plug-in to do that.

    I'm curious about your question because in 99% of the use cases, the only way you would have any control like that would be if people were navigating within your site with the address bar and not finding the pages. If that is the case then you need to look into having better navigation and if they are clicking to get there then you need to have a way to check your links and improve site management.

    People do navigate wikis that way but wiki engines never return 404 codes.

    I think you are trying to solve the wrong problem.

    You might be able to configure a webserver to return a static page instead of a 404. Look into that.

    Source(s): knowledge of the HTTP protocol
  • Anonymous
    1 decade ago

    Not sure you can do that, precisely, but if you are using php you could say

    echo "You requested: ".$_SERVER['REQUEST_URI'];

    (note you can't put a global variable inside quotes for some odd reason.)

    I actually use this global variable when i get the system to email me if 404s take place (which i do so i can trap the most common ones and reroute them automatically to where they really wanted to go in my .htaccess file).

    Does this help?

  • Anonymous
    1 decade ago

    Please do NOT use frames...they make websites really annoying to index properly!

Still have questions? Get your answers by asking now.