Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.htaccess - passing the request_uri to perl script...

Status
Not open for further replies.

spewn

Programmer
May 7, 2001
1,034
i have a site that is getting page 404's because a bad url is trying to be accessed.

i'm tasked with finding the page that is trying to be requested.

i tried to do this right from the perl file that 404's get redirected to, but it seems that the environmental variables are being "lost" in the redirect from htaccess.

so i tried getting the request_uri from htaccess and pass to perl:

Code:
ErrorDocument 404 [URL unfurl="true"]http://palmresearch.com/page-not-found.pl?u=%{REQUEST_URI}[/URL]

which is what i got off the web, but it passes "%{REQUEST_URI}" literally, instead of the actual uri.

i don't know if i'm accessing incorrectly.

any ideas?

- g
 
Hi

spewn said:
i'm tasked with finding the page that is trying to be requested.
Then you need no [tt]ErrorDocument[/tt], just the log files :
Code:
grep 'File does not exist' /path/to/error_log

[gray]# or[/gray]

grep '" 404 ' /path/to/access_log
spewn said:
i tried to do this right from the perl file that 404's get redirected to, but it seems that the environmental variables are being "lost" in the redirect from htaccess.
If the site where the erroneous request occurs is not palmresearch.com, then indeed there will be no way to receive information about the failed request.

If the site where the erroneous request occurs is palmresearch.com, then remove the protocol and domain from the document parameter :
Code:
ErrorDocument 404 /page-not-found.pl
spewn said:
it passes "%{REQUEST_URI}" literally, instead of the actual uri.
Of course it is. Such variable notation is known by mod_rewrite only and [tt]ErrorDocument[/tt] is a core feature.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top