+ Reply to Thread
Results 1 to 4 of 4

Thread: no directory exist

  1. #1
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    no directory exist

    I'm not sure how I would display a specific custom error page for
    dir/non_existent_dir_1

    I know to display a regular 404 error page would be using cPanel, but i want this to be a custom one different from just a regular 404.

    Like it would say, this directory could not be found, please go to home
    instead of the regular, this page is missing

    I was thinking maybe a .htaccess?

  2. #2
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: no directory exist

    I don't know of any way of doing this through .htaccess. However, you could use this snippet I made to check if the missing page is a directory of a page, and then output a different html depending.
    PHP Code:
    <?php
    if (is_dir($_SERVER['PHP_SELF'])) {
        
    //It is a directory, output directory only 404 page

        //code here
        
    exit;
    } else {
        
    //It is a page, output page only 404 page

        //code here
        
    exit;
    }
    ?>
    Last edited by xav0989; 02-07-2009 at 10:13 AM.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  3. #3
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    Re: no directory exist

    It's done with .htaccess
    Add this to the .htaccess file in the directory you want to change:
    Code:
    ErrorDocument 404 file.php
    You can replace 404 with other status codes and of course change file.php into the url for the error document.
    Real programmers don't document their code - if it was hard to write, it should be hard to understand.

  4. #4
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: no directory exist

    thank you, i will go try that and see how it works

+ Reply to Thread

Similar Threads

  1. Disk Full
    By digitaljit in forum Free Hosting
    Replies: 2
    Last Post: 11-10-2008, 06:07 AM
  2. cgi script problem
    By stmartin in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 03-29-2008, 12:45 PM
  3. Internal Serve Error
    By xaakx in forum Free Hosting
    Replies: 6
    Last Post: 02-03-2008, 08:02 AM
  4. help!!
    By retro-bliss in forum Free Hosting
    Replies: 25
    Last Post: 12-07-2007, 01:12 PM
  5. php version
    By loveispoison in forum Free Hosting
    Replies: 10
    Last Post: 11-21-2007, 10:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers