When a visitor visits any wrong URL in the site , they see 404 not found error comes from server side by default. We can redirect the visitor from any invalid URL to any of the custom page or any page we want. For the most of the sites , we see that , they have a well designed 404 error page. When we visits any of the invalid url of their site it is automatic redirect to 404 page.
It can easily be done.
For this, first we have to develop a 404 error page we want to show. It can be in any language like html, php etc.
After creating the 404 custom page we can upload it in the server and can add 1 line code in .htaccess file which is located in the root folder.
ErrorDocument 404 "<H1>Page not found</H1>"// use this code if you want to show any error message
ErrorDocument 404 /404.html // use this code if you want visitor to redirect to any custom page or 404 page
0 Comment(s)