Is there a script that sends a user to an assigned page if the URL they want within a site is not found (Preferable Javascript or PHP)? I have seen it many times, but don't know how to do it. . .
Is there a script that sends a user to an assigned page if the URL they want within a site is not found (Preferable Javascript or PHP)? I have seen it many times, but don't know how to do it. . .
--Jas
function GreatMinds(){ return "Think Like Jas"; }
Make a file called .htaccess, and place that at the root directory. In this file, place the following:
Hope this helps.Code:ErrorDocument 404 http://www.yoursite.com/custom_page.html
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Only under Apache or some others.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Also, be careful about doing this manually on some webhosts.
Some use cpanel or other site control setups that will allow for you to change/control this from there, so look into that if you have a hosting account rather than your own server. If there is no option, though, this should work.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
--Jas
function GreatMinds(){ return "Think Like Jas"; }
Just .htaccess, nothing more or less.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Thanks!
It seems ninety percent of the help I get comes from you, now-a-days thetestingsite. Appreciate it!
--Jas
function GreatMinds(){ return "Think Like Jas"; }
A file starting with just a dot is usually a system file. This is a very specific file that is designed to control how your site is served, and there are many more things that can be included in the file.
Also be careful to not override an existing .htaccess file. (You may not be aware of it, as it may have been set up automatically.)
In a .htaccess file, you can just add or remove lines to change behavior. You can do so with this line and just add it to your existing file. Or, perhaps, you already have it linking to a default page, and you can instead change the existing line.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Bookmarks