Web Hosting Talk







View Full Version : Default Page


CasperMac
10-09-2005, 05:43 AM
How do you set up a server to redirect a user to a default page when the page the user is asking for no longer exist?

dollar
10-09-2005, 05:47 AM
Put a meta refresh tag in your 404 page ;)

CasperMac
10-09-2005, 06:04 AM
Could you explain a wee bit

Eric Lim
10-09-2005, 06:10 AM
He meant assuming that your users would hit the 404 page if they access a page that no longer exists in the server (not found), use the <meta> refresh to redirect the user to whatever page you specify. For example, including the following code in your default 404 page:


<head>
<meta HTTP-EQUIV="Refresh" CONTENT="4; URL=http://www.my.com">
</head>


The "4" represents 4 seconds.

JayC
10-09-2005, 05:01 PM
It's not clear to me from the original question that he's not just asking how to set up to serve a custom 404 page instead of the default server message.

If that's the case, you just need a line similar to this in your .htaccess file:

ErrorDocument 404 <filename>

Insert the name of the page you want to be displayed in response to a "not found" error... whatever you want it to be; it's usually something like /404.html or /notfound.html

And of course, it could just be your site's home page or any other page. But generally you'd want a page that explains to the user what happened, and offers navigation to the rest of your site and perhaps a search box.

AmyDaynes
10-12-2005, 05:55 PM
I am also curious, how do you set up a custom 404 page with HTML?

Can you just do that refresh link (meta tag refresh) thing whatsit mawoogle to a custom 404 page?

And what's a htaccess file?

Please excuse the made-up words! I think you get my point. I hope?

dollar
10-12-2005, 11:52 PM
Your setting in apache will say where the 404 page should be. Generally it's in the root web enabled folder (public_html for example).

That page is generally named 404.shtml or 404.html

Just create a file with the proper name and put it in the proper spot and it is what will be shown anytime a user trys to go somewhere that doesn't exist. You can put anything in that page that you want. You could put the meta tag in that file to send them to your homepage.

A htaccess file is a way to do some apache stuff without actually having access to your apache configuration.

Good htaccess page: http://www.javascriptkit.com/howto/htaccess.shtml

cedced
10-13-2005, 01:33 AM
u make a page 404.shtml and add script redirect