You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by alchemist vk <al...@gmail.com> on 2018/10/12 03:09:48 UTC

[users@httpd] Comparing values in RewriteCond directive

Hi All,
   I have one test uri 'http://example.com/test1.test2'.   How I can fetch
uri components test1 and test2 and compare them via RewriteCond directive?..

I tried like below:
   RewriteCond {REQUEST_URI} http://example.com/(.*)\.(.*)
   RewriteCond $1!=$2

But getting syntax error saying $1!=$2 is not proper syntax..

With Regards,
Venkatesh

[users@httpd] Re: Comparing values in RewriteCond directive

Posted by alchemist vk <al...@gmail.com>.
Hi everyone, able to resolve above issue with below rules:

RewriteCond %{REQUEST_URI} ^example.com(.*).(?!\1$)

RewriteRule ^.*$ - [R=404,L]

With Regards,

Venkatesh

On Fri, Oct 12, 2018 at 8:39 AM alchemist vk <al...@gmail.com> wrote:

> Hi All,
>    I have one test uri 'http://example.com/test1.test2'.   How I can
> fetch uri components test1 and test2 and compare them via RewriteCond
> directive?..
>
> I tried like below:
>    RewriteCond {REQUEST_URI} http://example.com/(.*)\.(.*)
>    RewriteCond $1!=$2
>
> But getting syntax error saying $1!=$2 is not proper syntax..
>
> With Regards,
> Venkatesh
>