I know you need to set up .htaccess file, but don't know what to put in it. I want to make it so somebody goes to mywebsite.com/nonexistentpage, instead of having the default (404 not found) , having it redirect to my own "oops" page or the index page? Also what directory would I have to put it in? (I'd guess it'd be public html?) Thank you
I wouldn't redirect to your index/home page. The visitor would not know there was an error, only that he's not where he thought he would be. Make yourself an html page for each error you want to customize and put it into a handy directory, say /error. your .htaccess file goes in the document root directory and might include something like this: ErrorDocument 401 /error/401.html ErrorDocument 403 /error/403.html ErrorDocument 404 /error/404.html ErrorDocument 500 /error/500.html Code (markup): cheers, gary
Oh thanks! So your saying, put .htaccess stating "ErrorDocument 404/page_it_redirects_to"?` In that case I would have to put .htaccess in every directory right? Thank you
Watch the spaces. It's "ErrorDocument 404", space, then the path to the error page "/error/404.html". (without the quotes) You only need the .htaccess file in your document root directory, and it applies to all sub-directories, too. cheers, gary