httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Aleksandersen <aleksandersen+apache....@runbox.com>
Subject [users@httpd] Accessing the request URI header
Date Sat, 03 May 2008 02:44:47 GMT
2008-05-03 04:01 skreiv Daniel Aleksandersen:
> 2008-05-03 03:03 skreiv Eric Covener:
> > On Fri, May 2, 2008 at 8:41 PM, Daniel Aleksandersen wrote:
> > > 2008-05-03 02:16 skreiv Joshua Slive:
> > > > On Fri, May 2, 2008 at 7:45 PM, Daniel Aleksandersen wrote:
> > >  > >  Header always set Content-Location
> > >  > > http://www.domain.tld/{REQUEST_URI}
> > >  > >
> > >  > >  Looks great, right? Well, it does not work great. How do I get
> > >  > > the request URI into the above wild-guess-at-a-syntax?
> > >  >
> > >  > Header doesn't have direct access to that variable. You'd need to
> > >  > use mod_rewrite to shove it into an environment variable and then
> > >  > %{variable}e in Header to get at it.
> > >
> > >  No, that will not work. If that had worked then this would have
> > > worked; as request_uri already is an enviromental variable-something:
> > >
> > >    Header always set Content-Location
> > > http://www.domain.tld/%{REQUEST_URI}
> >
> > REQUEST_URI  is a distinctly different class of (non-environment)
> > variable.  In mod_rewrite, environment variables (proper) are accessed
> > via %{ENV:FOO}.
>
> OK, so it may still be possible. How do I store the request URI to an
> environment variable trough mod_rewrite? Something like this, I presume:
>
> RewriteCond %{REQUEST_URI} something [env=REQUEST_URI:$1]
> Header always set Content-Location http://www.domain.tld/%{REQUEST_URI}

SetEnvIfNoCase Request_URI \/(.*)\..* requesturi=$1
Header always unset Content-Location
Header always set Content-Location /%{requesturi}e

That one works. :-) But only if I unset the old header before I set the new 
one for some strange reason.
-- 
Daniel Aleksandersen

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message