PDA

View Full Version : .htaccess Scripting


cwcs
11-12-2005, 06:50 PM
Ok, I'm scratching my head here. I have my .htaccess file set up to redirect to a php page when the user doesn't authenticate properly. Now here's the catch: I want to send the URL of the page the person is trying to access as part of the 103 URL (ie: /denied.php?url=notallowedinto.htm). Just doing an HTTP_REFERER call on the php page doesn't pull up anything.

1. Is it possible?
2. If it is, how do you do it?

Thanks in advance,

Chris

schleppel
11-12-2005, 08:37 PM
If you are using ErrorDocument like this in your .htaccess file:
ErrorDocument 403 /denied.php
it shouldn't visibly redirect, and you can use
echo $_SERVER['REQUEST_URI'];
to get the forbidden page in your PHP file.

cwcs
11-12-2005, 11:16 PM
Thanks! It works! You just saved me a lot of work!