how to show 'page not found' if php page do not exist

Discussion in 'PHP' started by greentree, Jun 25, 2008.

  1. #1
    I believe this is a php issues because this involve php page. I posted this in another form first, but that was before I realized I should have post this here.

    I used the php tag to show some posts from my blog into a php page on the main folder. The blog is located at www.domain.com/wordpress
    The main folder is www.domain.com

    The php page is named as index.php If I type in inde2x.php, that page show my blog. It doesn't show a page not found error.

    How do I set this so that if I type in inde2x.php or any php page that isn't in my folder, it show a page not found? I wouldn't mind creating a php error page that would appear when someone type in the wrong url...if someone would give me instruction on how to do that.
     
    greentree, Jun 25, 2008 IP
  2. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #2
    It's Wordpress' mod_rewrite settings overwriting your ErrorDocument page.

    Check your .htaccess or ensure wordpress isn't interested in it.

    Dan
     
    Danltn, Jun 25, 2008 IP
  3. greentree

    greentree Active Member

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #3
    You are correct, it is the wordpress that over write my ErrorDocument page. How do I fix it so that my error page could show?
     
    greentree, Jun 25, 2008 IP
  4. greentree

    greentree Active Member

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #4
    I found a solution to this problem. It was the wordpress preventing the ErrorDocument from working in the htaccess file so I moved the htaccess file containing the wordpress stuff to the folder the wordpress is in. And then I put the ErrorDocument in the empty htaccess in the root folder, and it worked. My error php page even show up in IE when the wrong url is typed. It isn't going to work if it is place in the same htaccess that contain the wordpress stuff so the wordpress stuff have to have it own htaccess in it own folder.
     
    greentree, Jun 26, 2008 IP
  5. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #5


    Examples:


    ErrorDocument 500 http://affil.sustainedhits.com/cgi-bin/testing
    ErrorDocument 404 /sorry_not_here.html
    ErrorDocument 401 /signup.html
    ErrorDocument 403 /not_authorized.php
     
    LittleJonSupportSite, Jun 26, 2008 IP