D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Quick PHP question



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 04 December 2002 12:04 am, David Johnson wrote:
Tom Salmon wrote:
If referer doesn't work could also try the requested URL:
$request = $_SERVER["REQUEST_URI"];

Thanks for all that everyone.
I can now get a referer value, only to discover that since it is coming
through the .htaccess, it can't get the original referer...

Anyone know of a way I can get the referer in the .htaccess file to pass
to the ErrorDocument?

The $REQUEST_URI variable is meant to do exactly that. It certainly works on 
the DCLUG site.  Try http://www.dclug.org.uk/test/ It is a false directory 
and will generate a 404. The PHP script loads $REQUEST_URI and clearly 
displays the value in the page.

I spent a fair bit of time on the 404 script because when Alex needs to move 
the LUG archive to a new directory every 6 months or so, I was getting a lot 
of mail from non-member visitors not able to find messages linked via Google 
etc. So I deliberately wrote the 404 to report the file and, in the case of 
requests in the current archive, tried to re-direct visitors to the moved 
file.

I've just checked and there's nothing unusual about the .htaccess to get this 
to work. It works with other error codes too.

Try using just $REQUEST_URI not the $_SERVER... one. (and get phpinfo() 
working too, you may have a customised PHP config and you will need to find 
out if the server uses a different variable.)

Or are you actually saying that you want the link that created that URL? i.e. 
on Google or somewhere? That will be in the server logs if anywhere - my 
codehelp site logs this - and is not accessible to PHP, whether .htaccess is 
used or not. Why not try a different approach, use Javascript to go back two 
steps in the history. window.history.go(-2);
http://www.codehelp.co.uk/query/glossaryH.shtml#history
(you can retrieve the actual URL too, but being Javascript, that won't be on 
the server but in the client.)



David.

- -- 

Neil Williams
=============
http://www.codehelp.co.uk
neil@xxxxxxxxxxxxxx
linux@xxxxxxxxxxxxxx
neil@xxxxxxxxxxxx

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE97UtOiAEJSii8s+MRAkh3AKC2g58NfW4kdFL45AC5cHbQ1PRGhACgnnKD
QN2B9qqcB0EidC1odTli1Xs=
=RoFd
-----END PGP SIGNATURE-----

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly