Jump to content


Photo

How would I...


  • Please log in to reply
4 replies to this topic

#1 drcdeath

drcdeath
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 30 October 2006 - 06:33 PM

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.html

Is 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.

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 30 October 2006 - 06:35 PM

echo basename($_SERVER['PHP_SELF']);

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 drcdeath

drcdeath
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 30 October 2006 - 06:45 PM

Thank you!

#4 drcdeath

drcdeath
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 30 October 2006 - 06:54 PM

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? :(

#5 Zane

Zane
  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 30 October 2006 - 07:04 PM

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 second


UPDATE:
take a look at this tutorial
http://www.onlamp.co...davidsklar.html

EDIT:
Nevermind, if you have it redirecting to 404.php already on an error then you must already have that setup
you need to tell 404.php to use the $_SERVER['REDIRECT_URL'] variable

btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank
 

172938.png




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users