Jump to content

[SOLVED] 404 Page Not Found Help


monkeybidz

Recommended Posts

I am trying to redirect users that try to go to a page on my site that does not exist. Currently if you go to www.mysite.com it will go to the index page, if you go to a page that does not exist like www.mysite.com/rick.php it will still go to the index rather than telling user that page does not exist. This is what I have so far:

 


$request=$_SERVER['REQUEST_URI'];
        
if(!$request or $request === FALSE){
    header("HTTP/1.0 404 Not Found");
    exit();
    }

 

Any help is appreciated.

Link to comment
Share on other sites

okay think about this monkey... The user goes to some random page that doesn't exist.  So how exactly do you think that that script of yours is going to execute? The only way it will execute is if someone goes to that script, and therefore it's not a 404.

 

In order to make a custom error page, you have to change a setting on the server itself.  If you have cpanel access it should be really easy for you to find.  Icon called "custom error messages/pages" or something.  You should be able to have the server load a specific target page of your choosing when 404 is triggered (or any other server code for that matter). 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.