English 中文(简体)
请求的URL没有出现在这一服务器上。
原标题:The requested URL was not found on this server

I have simple html site. how I can fix the problem The requested URL was not found on this server when user gives wrong URL. for example user type mydomain.com/abc.html and this page is not exist on server, so it will cause an error. how to redirect it on error page to avoid this error.

最佳回答

创建“htaccess”文档并添加这一条。

ErrorDocument 404 /foo.html>。

This will redirect any 404 error to foo.html

问题回答

暂无回答




相关问题
Separating Business Layer Errors from API errors

The title is horrible, i know; I m terrible at titles on SO here. I m wondering what would be the best way to present unified error responses in a webapi when errors could be raised deep inside the ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

How to tell why a file deletion fails in Java?

File file = new File(path); if (!file.delete()) { throw new IOException( "Failed to delete the file because: " + getReasonForFileDeletionFailureInPlainEnglish(file)); } Is there a ...

Exceptions: redirect or render?

I m trying to standardize the way I handle exceptions in my web application (homemade framework) but I m not certain of the "correct" way to handle various situations. I m wondering if there is a ...