Generic error page

Discussion in 'PHP' started by enchance, Oct 7, 2007.

  1. #1
    Can php display an error page whenever the user tries to access a page in the site which does not exist?
     
    enchance, Oct 7, 2007 IP
  2. gigamike

    gigamike Active Member

    Messages:
    165
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Hi,

    im not sure but i think it cannot, what you should do is to set an htaccess for broken URL. Modwrite, so you can redirect user.

    Thanks,

    Mike

     
    gigamike, Oct 8, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    PHP can't, but .htaccess can.

    
    ErrorDocument 404 /path/to/error_404_file.html
    
    Code (markup):
     
    nico_swd, Oct 8, 2007 IP
  4. enchance

    enchance Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'm using xamp as my localhost, where can I find the .htaccess file there and when I finally upload this to my online server where would it be there?

    Btw, what does the "ht" mean in .htaccess?
     
    enchance, Oct 9, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    You have to create it manually in the directory you're currently working in.

    And it stands for hyper text, if I remember correctly.
     
    nico_swd, Oct 9, 2007 IP
  6. enchance

    enchance Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks guys. I got the hang of it now.
     
    enchance, Oct 10, 2007 IP
  7. notrick

    notrick Banned

    Messages:
    178
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Its possible with .htaccess file only
     
    notrick, Oct 10, 2007 IP