jamesjmann Posted February 3, 2011 Share Posted February 3, 2011 Hey, I was wondering if there is a way to customize the 404 error page I designed using php. My host is Godaddy. Here is what my 404 page error says: Oops, 404 Error! That page is no longer in my site! I recently redesigned and reorganized my site, so there may be a few misdirected links that I don't know are out there. We'll never know for sure, so please just navigate to a new page! This is what I want it to display: Oops, 404 Error! The page [b]http://www.yourwebsite.com/theurlthatdoesnotexist[/b] is no longer in my site! I recently redesigned and reorganized my site, so there may be a few misdirected links that I don't know are out there. We'll never know for sure, so please just navigate to a new page! How can I make it so that when the user goes to a url that does not exist, the url that was typed in the browser appears in the 404 error message? I've seen this done before so I know it's not impossible. Link to comment https://forums.phpfreaks.com/topic/226593-404-error/ Share on other sites More sharing options...
MatthewJ Posted February 3, 2011 Share Posted February 3, 2011 http://help.godaddy.com/article/1 Link to comment https://forums.phpfreaks.com/topic/226593-404-error/#findComment-1169521 Share on other sites More sharing options...
jamesjmann Posted February 3, 2011 Author Share Posted February 3, 2011 http://help.godaddy.com/article/1 I already set up my error page with godaddy, but Godaddy can't put the php code in your error page for you. That's why I posted my question here. i was wondering if there was a php code I could use that could input that information into the page. Link to comment https://forums.phpfreaks.com/topic/226593-404-error/#findComment-1169523 Share on other sites More sharing options...
jamesjmann Posted February 3, 2011 Author Share Posted February 3, 2011 NVM. I found that by inserting this: <?php function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } ?> <?php echo curPageURL(); ?> I can get the current url in the user's browser to display within the page. Link to comment https://forums.phpfreaks.com/topic/226593-404-error/#findComment-1169524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.