You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Darryl Philip Baker <da...@northwestern.edu> on 2019/02/07 21:25:14 UTC
[users@httpd] Need a conditional rewrite/redirect rule
I don't write conditional rewrite rules often but this is a case where I need one. My customer wants the affect of:
RedirectMatch permanent ^/foo/bar/(.*)$ http<http://www.example.com/foo/bar/index.html>://www.example.com/foo/bar/file.html<http://www.example.com/foo/bar/index.html>
Which would of course create a redirect loop.
What I want is a conditional rewrite or redirect rule which would send requests for http://www.example.com/foo/bar/<http://www.example.com/foo/bar/>{any file or path} except http://www.example.com/foo/bar/file.html<http://www.example.com/foo/bar/file.html> to http://www.example.com/foo/bar/file.html.
Anyone solved this already and is willing to share?
Darryl Baker
Sr. System Administrator
Distributed Application Platform Services
Project Management Office and Enabling Technologies
Northwestern | Information Technology
1800 Sherman Ave., Suite 600
Evanston, IL 60201-3715
(847) 467-6674
www.it.northwestern.edu
Re: [users@httpd] Need a conditional rewrite/redirect rule
Posted by Yann Ylavic <yl...@gmail.com>.
On Thu, Feb 7, 2019 at 10:25 PM Darryl Philip Baker
<da...@northwestern.edu> wrote:
>
> What I want is a conditional rewrite or redirect rule which would send requests for http://www.example.com/foo/bar/{any file or path} except http://www.example.com/foo/bar/file.html to http://www.example.com/foo/bar/file.html.
>
> Anyone solved this already and is willing to share?
No need for a rewrite rule, something like:
RedirectMatch permanent ^/foo/bar/(?!file.html$)(.*)$
http://www.example.com/foo/bar/file.html
(where (?!...) stands for not followed by ...)
Regards,
Yann.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Need a conditional rewrite/redirect rule
Posted by Yann Ylavic <yl...@gmail.com>.
On Thu, Feb 7, 2019 at 11:06 PM Eric Covener <co...@gmail.com> wrote:
>
> Here's an example w/ "negative lookahead" in PCRE.
>
> RedirectMatch permanent ^/foo/bar/(?!file.html$)
> http://www.example.com/foo/bar/file.html
Yeah, or that :)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Need a conditional rewrite/redirect rule
Posted by Darryl Philip Baker <da...@northwestern.edu>.
After trying to read the gibberish ProofPoint turned your response into, I when to the mailing list archive site.
Thanks.
Darryl Baker (he/him/his)
Sr. System Administrator
Distributed Application Platform Services
Northwestern University
1800 Sherman Ave.
Suite 6-600 – Box #39
Evanston, IL 60201-3715
darryl.baker@northwestern.edu
(847) 467-6674
On 2/7/19, 4:06 PM, "Eric Covener" <co...@gmail.com> wrote:
On Thu, Feb 7, 2019 at 4:25 PM Darryl Philip Baker
<da...@northwestern.edu> wrote:
>
> I don't write conditional rewrite rules often but this is a case where I need one. My customer wants the affect of:
>
>
> RedirectMatch permanent ^/foo/bar/(.*)$ https://urldefense.proofpoint.com/v2/url?u=http-3A__www.example.com_foo_bar_file.html&d=DwIBaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=tdje61_VHSXp608oLofeaJnnzo2Sr9_Cdcp70bBEtQ8&m=bfHWYFXFAs_gCtSrNYZGxg6N46vIGLQLwmzneEwE2yE&s=mLGeu_HVTa-0wWBSITg29Wgl345fVYe6hQmVgyzRptM&e=
>
> Which would of course create a redirect loop.
>
> What I want is a conditional rewrite or redirect rule which would send requests for https://urldefense.proofpoint.com/v2/url?u=http-3A__www.example.com_foo_bar_-257Bany&d=DwIBaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=tdje61_VHSXp608oLofeaJnnzo2Sr9_Cdcp70bBEtQ8&m=bfHWYFXFAs_gCtSrNYZGxg6N46vIGLQLwmzneEwE2yE&s=fgosmtrDZ_THwM57DgQidtKu0kUgP2tyeuwCrG5RowA&e= file or path} except https://urldefense.proofpoint.com/v2/url?u=http-3A__www.example.com_foo_bar_file.html&d=DwIBaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=tdje61_VHSXp608oLofeaJnnzo2Sr9_Cdcp70bBEtQ8&m=bfHWYFXFAs_gCtSrNYZGxg6N46vIGLQLwmzneEwE2yE&s=mLGeu_HVTa-0wWBSITg29Wgl345fVYe6hQmVgyzRptM&e= to https://urldefense.proofpoint.com/v2/url?u=http-3A__www.example.com_foo_bar_file.html&d=DwIBaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=tdje61_VHSXp608oLofeaJnnzo2Sr9_Cdcp70bBEtQ8&m=bfHWYFXFAs_gCtSrNYZGxg6N46vIGLQLwmzneEwE2yE&s=mLGeu_HVTa-0wWBSITg29Wgl345fVYe6hQmVgyzRptM&e=.
>
> Anyone solved this already and is willing to share?
Here's an example w/ "negative lookahead" in PCRE.
RedirectMatch permanent ^/foo/bar/(?!file.html$)
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.example.com_foo_bar_file.html&d=DwIBaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=tdje61_VHSXp608oLofeaJnnzo2Sr9_Cdcp70bBEtQ8&m=bfHWYFXFAs_gCtSrNYZGxg6N46vIGLQLwmzneEwE2yE&s=mLGeu_HVTa-0wWBSITg29Wgl345fVYe6hQmVgyzRptM&e=
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Need a conditional rewrite/redirect rule
Posted by Eric Covener <co...@gmail.com>.
On Thu, Feb 7, 2019 at 4:25 PM Darryl Philip Baker
<da...@northwestern.edu> wrote:
>
> I don't write conditional rewrite rules often but this is a case where I need one. My customer wants the affect of:
>
>
> RedirectMatch permanent ^/foo/bar/(.*)$ http://www.example.com/foo/bar/file.html
>
> Which would of course create a redirect loop.
>
> What I want is a conditional rewrite or redirect rule which would send requests for http://www.example.com/foo/bar/{any file or path} except http://www.example.com/foo/bar/file.html to http://www.example.com/foo/bar/file.html.
>
> Anyone solved this already and is willing to share?
Here's an example w/ "negative lookahead" in PCRE.
RedirectMatch permanent ^/foo/bar/(?!file.html$)
http://www.example.com/foo/bar/file.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org