You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "J. Peng" <pe...@gmail.com> on 2008/02/28 06:51:13 UTC
[users@httpd] rewrite based on Accept-Encoding header
Can we do a rewrite based on Accept-Encoding request header?
If the request header includes "Accept-Encoding: gzip, deflate", we
rewrite it to pathA.
Otherwise rewrite it to pathB.
thanks.
//joy
---------------------------------------------------------------------
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
Re: [users@httpd] rewrite based on Accept-Encoding header
Posted by "J. Peng" <pe...@gmail.com>.
On Fri, Feb 29, 2008 at 11:32 AM, Joshua Slive <jo...@slive.ca> wrote:
>
> Start by taking the stuff out of the Location block: that is
> explicitly unsupported and unnecessary when the RewriteRule is already
> checking for /test2.
That's right.I almost forgot that mod_rewrite is working on apache's
Trans handler, this handler is working before any dir mapping. so a
Location section is invalid.
Have resolved it, thanks.:)
//joy
---------------------------------------------------------------------
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
Re: [users@httpd] rewrite based on Accept-Encoding header
Posted by Joshua Slive <jo...@slive.ca>.
On Thu, Feb 28, 2008 at 9:38 PM, J. Peng <pe...@gmail.com> wrote:
>
> On Thu, Feb 28, 2008 at 10:35 PM, Joshua Slive <jo...@slive.ca> wrote:
> >
> > On Thu, Feb 28, 2008 at 12:51 AM, J. Peng <pe...@gmail.com> wrote:
> > > Can we do a rewrite based on Accept-Encoding request header?
> > > If the request header includes "Accept-Encoding: gzip, deflate", we
> > > rewrite it to pathA.
> > > Otherwise rewrite it to pathB.
> >
> > Yes. The docs are here:
> > http://httpd.apache.org/docs/2.2/rewrite/
> >
> > Give it a try and come back with your best guess and a specific
> > problem description if you can't figure it out.
> >
>
> Thanks for the document.
> I have installed httpd-2.2.8 and set the rewrite rules as:
>
> <Location /test2>
> RewriteEngine On
> RewriteCond %{HTTP:Accept-Encoding} gzip [OR]
> RewriteCond %{HTTP:Accept-Encoding} deflate
> # RewriteRule ^/test2/(.*) /test/$1 [PT,L]
> RewriteRule ^/test2/(.*) /test/$1 [R,L]
> </Location>
>
> It doesn't work. do you know why?
Start by taking the stuff out of the Location block: that is
explicitly unsupported and unnecessary when the RewriteRule is already
checking for /test2. Then use the RewriteLog to see what is going on.
Joshua.
---------------------------------------------------------------------
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
Re: [users@httpd] rewrite based on Accept-Encoding header
Posted by "J. Peng" <pe...@gmail.com>.
On Thu, Feb 28, 2008 at 10:35 PM, Joshua Slive <jo...@slive.ca> wrote:
>
> On Thu, Feb 28, 2008 at 12:51 AM, J. Peng <pe...@gmail.com> wrote:
> > Can we do a rewrite based on Accept-Encoding request header?
> > If the request header includes "Accept-Encoding: gzip, deflate", we
> > rewrite it to pathA.
> > Otherwise rewrite it to pathB.
>
> Yes. The docs are here:
> http://httpd.apache.org/docs/2.2/rewrite/
>
> Give it a try and come back with your best guess and a specific
> problem description if you can't figure it out.
>
Thanks for the document.
I have installed httpd-2.2.8 and set the rewrite rules as:
<Location /test2>
RewriteEngine On
RewriteCond %{HTTP:Accept-Encoding} gzip [OR]
RewriteCond %{HTTP:Accept-Encoding} deflate
# RewriteRule ^/test2/(.*) /test/$1 [PT,L]
RewriteRule ^/test2/(.*) /test/$1 [R,L]
</Location>
It doesn't work. do you know why?
---------------------------------------------------------------------
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
Re: [users@httpd] rewrite based on Accept-Encoding header
Posted by Joshua Slive <jo...@slive.ca>.
On Thu, Feb 28, 2008 at 12:51 AM, J. Peng <pe...@gmail.com> wrote:
> Can we do a rewrite based on Accept-Encoding request header?
> If the request header includes "Accept-Encoding: gzip, deflate", we
> rewrite it to pathA.
> Otherwise rewrite it to pathB.
Yes. The docs are here:
http://httpd.apache.org/docs/2.2/rewrite/
Give it a try and come back with your best guess and a specific
problem description if you can't figure it out.
Joshua.
---------------------------------------------------------------------
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