本文介绍了在此服务器上找不到请求的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的html网站。当用户输入错误的URL时,如何解决在此服务器上找不到请求的URL的问题例如,用户键入mydomain/abc.html,并且服务器上不存在该页面,因此将导致错误。如何在错误页面上重定向它以避免该错误。
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/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文件并添加此行。
Create a .htaccess file and add this line.
ErrorDocument 404 /foo.html
此会将任何404错误重定向到foo.html
This will redirect any 404 error to foo.html
更多推荐
在此服务器上找不到请求的URL
发布评论