Page 1 of 1
Custom 404 error pages
Posted: Tue Sep 27, 2005 2:17 am
by iNSiPiD
I'd ike to include the referrer URL in my custom error page so that people can actually report the broken link.
What code should I drop into my template? Do I need to activate {php} tags?
I understand using referer(sic) isn't foolproof on all servers, so I'd like it if the CMS could actually grab the bad URL and drop this into the page.
Any and all methods appreciated.
Re: Custom 404 error pages
Posted: Tue Sep 27, 2005 2:31 am
by calguy1000
try creating a user tag, there are lots of articles in this forum on user tags. inside user tags you can do php with no problems.
Re: Custom 404 error pages
Posted: Tue Sep 27, 2005 3:36 am
by iNSiPiD
And then call the user tag from within the 404 template? I don't think that'll work Calguy1000 but I'm keen to try.
Now, if only someon would supply the necessary code...

Re: Custom 404 error pages
Posted: Tue Sep 27, 2005 4:45 am
by Ted
echo $_SERVER['HTTP_REFERER'];
Re: Custom 404 error pages
Posted: Wed Sep 28, 2005 12:29 am
by iNSiPiD
Why she no work?
I created a new user tag called {http_referer} with the server call below.
I then put the following into my custom page and applied a nice new template.
This page doesn't appear to exist on our server.
If you typed the address in, please check the URL for errors.
To report a broken link please email the Webmaster and provide details of the page you were tryng ot reach.
Please copy this link into your email: {http_referer}
The page looks great and works as expected except that the referring page doesn't show up. The referring page is actually not what I want anyway. I really want to display the current page's URL. Sorry.
Re: Custom 404 error pages
Posted: Sun Oct 22, 2006 1:24 pm
by Christophe Lambrechts
The current URL can displayed as follow:
Code: Select all
urlencode($_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"])