The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Adding Custom Error Pages for non-existant pages

Discussion in 'General Discussion' started by YukFoo, Sep 15, 2002.

  1. YukFoo

    YukFoo Well-Known Member

    Joined:
    Sep 1, 2002
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    Looking to add custom error pages so that non-existant pages forward to main index.php page.

    Before I had my own server I'd used the meta refresh tag, but this isn't working. Any ideas.
     
  2. hedgehog

    hedgehog Well-Known Member

    Joined:
    Nov 3, 2001
    Messages:
    122
    Likes Received:
    0
    Trophy Points:
    16
    You could simply insert some javascript code in the page to have it auto load the index.php page... should be a piece of cake... just add the following lines in your custom error page.

    Naturally, you should remember to replace the domain name with your own.

    &Script Language=&JavaScript&&
    &!--
    setTimeout (&changePage()&, 0);
    function changePage() {
    self.parent.location= &http://www.yourdomain.com/&;
    }
    // --&
    &/script&
     
  3. hedgehog

    hedgehog Well-Known Member

    Joined:
    Nov 3, 2001
    Messages:
    122
    Likes Received:
    0
    Trophy Points:
    16
    By the way, you could also insert a meta refresh tag in your header... Works just the same.

    Good luck
     
  4. YukFoo

    YukFoo Well-Known Member

    Joined:
    Sep 1, 2002
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    HedgeHog,

    I appreciate the input. (kick myself). Helps when you read the directions a little. Custom error pages should be at least 10KB in size. IF they aren't the meta refresh won't work. My pages were only like 1 KB. :)
     
Loading...

Share This Page