|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
How can you retrieve the requested URL from an Apache handler?
For example, if URL is the requested URL, I'd like to get that URL as a string. The method Apache::uri() always seems to provide the URL already translated to an absolute path, regardless of what translation stage the handler is configured for. I've looked through Writing Apache Modules with Perl and C, but couldn't find an answer to this. |
|
#2
|
|||
|
|||
|
You can get /whatever.htm from the env var: REQUEST_URI. This variable is the relative path to your docroot begins with a slash /.
Here is an example in Perl: (http://www.domain.com/cgi-bin/env.pl) #!/usr/bin/perl print "Content-type: text/html\n\n"; print "$ENV{'REQUEST_URI'}\n"; And it would print /cgi-bin/env.pl. If you want it as a string: #!/usr/bin/perl $request_uri = "$ENV{'REQUEST_URI'}"; print "Content-type: text/html\n\n"; print "$request_uri\n"; |
|
#3
|
|||
|
|||
|
Thanks
![]() For some reason, it hadn't occurred to me to simply use the same environment variables that I would use in a CGI script. Actually, it's HTTP_HOST that contains the info I'm interested in, and that's available from the handler as well. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Getting requested URL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|