drcdeath Posted October 30, 2006 Share Posted October 30, 2006 How would I get the information from the address bar after the slash using php?To be more specific I mean this:www.example.com/mypage.htmlIs there a way I can get the "mypage.html" using PHP. I want to create a page with a sentence like this:"The requested URL "mypage.html" could not be found" If you catch my drift.Any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/25610-how-would-i/ Share on other sites More sharing options...
Orio Posted October 30, 2006 Share Posted October 30, 2006 echo basename($_SERVER['PHP_SELF']);Orio. Quote Link to comment https://forums.phpfreaks.com/topic/25610-how-would-i/#findComment-116873 Share on other sites More sharing options...
drcdeath Posted October 30, 2006 Author Share Posted October 30, 2006 Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/25610-how-would-i/#findComment-116878 Share on other sites More sharing options...
drcdeath Posted October 30, 2006 Author Share Posted October 30, 2006 Wasn't quite solved :(.It keeps redirecting to 404.php if I have an error so if I type in www.example.com/asdmkoasndaojsdnasd.php the address bar will change to www.example.com/404.php and not stay as "asdmkoasndaojsdnasd.php" so it says:"The requested "404.php" was not found"Any clues? :( Quote Link to comment https://forums.phpfreaks.com/topic/25610-how-would-i/#findComment-116881 Share on other sites More sharing options...
Zane Posted October 30, 2006 Share Posted October 30, 2006 If it's custom 404 pages your wanting, you'll have to edit the 404.shtml file to forward those variables to 404.php.I can't remember the exact instructions but I can find out for you in a secondUPDATE:take a look at this tutorialhttp://www.onlamp.com/pub/a/onlamp/2003/02/13/davidsklar.htmlEDIT:Nevermind, if you have it redirecting to 404.php already on an error then you must already have that setupyou need to tell 404.php to use the $_SERVER['REDIRECT_URL'] variable Quote Link to comment https://forums.phpfreaks.com/topic/25610-how-would-i/#findComment-116887 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.