You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Luis Speciale <ls...@gmail.com> on 2019/09/25 10:23:30 UTC
[users@httpd] Redirect only if 2 conditions
Hi
I want to redirect (in my local server) all the external visitors that
don't ask for an existing directory.
<If "%{REMOTE_ADDR} !='192.168.0.254' && %{REQUEST_FILENAME}
!='/Library/WebServer/Documents/YES/'">
RedirectMatch ^/((?!index_ext.html).*)$ /index_ext.html
</If>
But AND (&&) doesn't seem to work. I'm always redirected to /index_ext.html
What am I missing ?
Thanks
Re: [users@httpd] Redirect only if 2 conditions
Posted by Eric Covener <co...@gmail.com>.
On Wed, Sep 25, 2019 at 6:23 AM Luis Speciale <ls...@gmail.com> wrote:
>
> Hi
>
> I want to redirect (in my local server) all the external visitors that don't ask for an existing directory.
>
> <If "%{REMOTE_ADDR} !='192.168.0.254' && %{REQUEST_FILENAME} !='/Library/WebServer/Documents/YES/'">
> RedirectMatch ^/((?!index_ext.html).*)$ /index_ext.html
> </If>
>
> But AND (&&) doesn't seem to work. I'm always redirected to /index_ext.html
>
> What am I missing ?
That recipe works for me. I suggest preceding with:
Header always set rf "expr=%{REQUEST_FILENAME}"
Header always set ra "expr=%{REMOTE_ADDR}"
And see if it's not some more subtle string matching problem.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org