Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!204.52.135.9.MISMATCH!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Date: Mon, 25 Jun 2012 12:55:16 +0200 From: Luuk User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.php Subject: Re: Apache and php to show http request headers. References: <041d6312-2dee-4535-8215-6e9dbcb1e274@z19g2000vbe.googlegroups.com> In-Reply-To: <041d6312-2dee-4535-8215-6e9dbcb1e274@z19g2000vbe.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: Lines: 42 NNTP-Posting-Host: 2001:980:9089:1:f1ca:6a58:d24f:7ec1 X-Trace: 1340623802 news.xs4all.nl 6902 [2001:980:9089:1:f1ca:6a58:d24f:7ec1]:53432 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.php:6418 On 25-06-2012 12:15, brumik wrote: > > I need to test various http requests from an application and am using > Apache/PHP on ubuntu to display the http request headers. The > application proxy forwards http requests to the apache server's IP > address like as follows: > > 192.168.40.1/test/test.html > > where 192.168.40.1 is the apache server. > > I have a php script to dump the headers as follows: > > foreach($_SERVER as $h=>$v) > #if(ereg('HTTP_(.+)',$h,$hp)) > echo "
  • $h = $v
  • \n"; > header('Content-type: text/html'); > ?> > > The problem is that to show the headers, I redirect 192.168.40.1/* to > the above index.php page using the following redirect: > > Options +FollowSymlinks > RewriteEngine on > RewriteCond %{REQUEST_URI} !/index.php$ > > RewriteRule $ /index.php [R=302,L] > > However the php request headers page always shows the URI as / > index.php as opposed to the 'original' URI requested (/test/ > test.html). > > How can I get it to show the 'original' URI requested? is this > something that can be done in PHP or is it apache specific? > Its apache, because it is redirecting, so PHP does only know about the redirected request, and does have no knowledge of how this request reached PHP.