Well after a week of my site being opened, i decided to remove the shitty default host gator one. i googled for about 10mins, trying to find a 404 source that could give me the apache error, and then redirect in 10 seconds. i found someome post th apache source, but im having trouble with it cause it says if the directory is like /sdsaodsakd this is the code i have <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML><HEAD> <TITLE>404 Not Found</TITLE> </HEAD><BODY> <H1>Not Found</H1> The requested URL / was not found on this server.<P> <P>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. <HR> <ADDRESS>Apache/1.3.37 Server at SERVER.TLD Port 80</ADDRESS> </BODY></HTML> <!-- --> <!-- --> Code (markup): id like to have it redirect after 10 seconds and for it to display the correct directory. +rep and love for whoever helps me fix this lol
Add this code between your <head>-tags: <META http-equiv="refresh" content="10;URL=yourURL"> Replace yourURL with the link to your directory. As an example: http://www.yoursite/yourdirectory The 10 represents in how many seconds the visitor gets redirected. I would consider a permanent 301 redirect because it's more search engine friendly.
In php: <?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.yourdomain.com/directory"); ?> In .htaccess: Redirect 301 /oldlocation http://www.yourdomain.com/newlocation Hope this helps.
my site is new and doesn't (or shouldn't) have any broken pages. i'm just looking for a 404 redirect with the correct apache code, i guess ill use 301 in the future if i move sutff
Insert the following code in your .htaccess: ErrorDocument 404.html Then create a 404.html where you insert the code you mentioned in the first post and add the metatag which I have given to you. Can I get my rep now please.
that's not what i'm asking - the code i posted is incorrect apache 404. http://www.encorearcade.com/isdafjdisjfsdifji it won't say error in /isdafjdisjfsdifji, it just says /.
You could set up a custom 404 error so that it shows up a custom error (as opposed to what you see now). Example: http://xinhuafinance.com/en/ee This can be set up in both Windows (IIS) and Apache (.htaccess).
Now I begin to understand a bit more what you want. Of course you get this error because it's in your plain HTML code, so I don't understand what kind of error text you expect then. Change the '/' just in '/wrongdirectory' and then you will get the right error message. But this is static and doesn't make any sense then. If you want it dynamic so it changes every time to the name of the directory which isn't found. Then I would use PHP to get all text after the domainname. Put this PHP-code instead of the '/' after The requested URL: <?php echo $_SERVER['PHP_SELF']; ?> There's a possibility it just shows the name of you error document. Just try if this works. I hope your server supports PHP and you know how to handle with it. Don't forget to change the extension to .php. Don't forget to change the redirect to the error page to 404.php instead of 404.htm . You say you want to display the correct directory by redirecting to it after 10 seconds. I already mentioned the metatags which you have to add. But I think you can read what you really want here: http://www.onlamp.com/pub/a/onlamp/2003/02/13/davidsklar.html