Get Current URL

I was create a custom error page.
 can I get a string containt current URL error ?

as, if you type
this is will show custom error page (404).

 How I can echo current URL ("") ?

Thank for your patience

Best Regards
Who is Participating?
gonzoramaConnect With a Mentor Commented:
You can get that stuff from the ENVironment variables.
They should be located in the $_SERVER global array.

try doing this:

you should be interested in:

Your web host must allow you to access the file: .htaccess in order to create custom 404 error pages.  Web hosts normally don't advertise saying that they DO allow you change .htaccess in their hosting plans/packages., so you'll have to ask them yourself (do NOT try it out if you don't know, it can result to messing up your entire domain)

If you find out that you have access to it, go to notepad (or any other text editor of your choice) and type:

ErrorDocument 404

Then save the file as: ".htaccess" (With the quotes..yes..that's an 8 character-long extension)

Then just ftp the file to your root directory.

Hope that helps
I guess I misread.  You can't get that info from php.  Why?  Because if there WAS a 404 error, then the user wouldn't be able to access your php code in the first place.

If you want to be notified of an error on your page (which is why you probably want to get the string), then you can redirect the 404 error to a php page.  That php page can email you, telling you that there was a 404 error. will give you some basic knowledge of the .htaccess file and customized page errors.
bonbonkoreanAuthor Commented:
well ! :D

thanks you for your reply !
 But I was found it.

 If I type a error page, as

 A 404 page will show, and a value $_SERVER['QUERY_STRING']
have "404;"

And I can get the URL error:

thanks, gonzorama. You right.
thanks, ragnorus because your comment !
All Courses

From novice to tech pro — start learning today.