0

I'm currently working on a webpage whose links work as index.php?do=buy, ?do=sell, ?do=catalog, etc.

However, I stopped for a second, and thought: what if someone changes it? (?do=idontexist) What should I do?

  • Just ignore the change, and display the default (main/index) page
  • Show a [generic] 404 page
  • Throw a custom error:

mockup

download bmml source – Wireframes created with Balsamiq Mockups

Which of these is the best choice?

3 Answers 3

1

I would suggest a 404 page, perhaps with a search bar so that the user isn't left stranded. The 404 page needn't be a complete obstacle - with a little creativity, it can even provide a small, but positive user experience.

Examples: http://www.creativebloq.com/web-design/best-404-pages-812505

0

I think the standard approach is to use a 404 page for any page that doesn't exist. Since you're using the php as links, and each do= is essentially a new page, a 404 makes sense here.

If, alternatively, your php took arguments to some function, it would probably be better to do input validation in that function.

0

Informing the user that the page doesn't exist is best. If there were a legitimate reason for someone's trying an invalid url, wouldn't they wonder why the site is just redirecring them to the home page? In addition, if you can anticipate what the user will do next or offer some guidance, that would be better.

For example, you could do a search for the page name, show frequent topics/products/etc. MediaWiki has a creative way of dealing with missing pages: going to a missing page = creating that page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.