Multiple condition tags are "and'ed" while evaluating the rule. For your
use-case, the underneath should suffice
<rule>
<condition name="host" operator="equal" next="or">www.example.org </condition>
<condition name="host" operator="equal">example.org</condition>
<from>(.*)</from>
<to last="true" type="permanent-redirect">http://www.example.com$1</to>
</rule>
Cheers
Avlesh
On Sat, Oct 31, 2009 at 12:43 AM, mahesh <hariprasad.kanamarlap...@gmail.com
I tried really hard, but failed to understand the acronym!
but the below rules were correct or not to achieve the same(to redirect www
> and non-www url to www).
> <condition name="host" operator="equal">www.example.org</condition>
> <condition name="host" operator="notequal">^$</condition>
> ...
I don't think you would achieve what you want with these conditions. What
makes you think that <condition name="host"
operator="notequal">^$</condition> would NOT match anything under the sun?
It is rule which essentially says "*when the host is NOT equal to an empty
string*". Read the previous statement once more, and you would realize that
*it is true for all requests *(because every request has a host header). As
I earlier said, multiple <condition>'s are AND'ed with other, so in effect
your rule only applies to requests from www.example.org domain.
Did I make it clear?
Please let me know ASAP.
Your urgency is understood and respected. Queries on this mailing list don't
go unanswered. Don't get impatient.
Cheers
Avlesh
On Mon, Nov 2, 2009 at 3:13 PM, mahesh
<hariprasad.kanamarlap...@gmail.com>wrote:
when we enter some thing in the host and then checks the condition
like
http header!= " " and so the condition is always became TRUE.
here is a log-
[10/5/09 9:20:47:092 EDT] 0000002e WebApp A SRVE0180I:
[Servlet.LOG]:
org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: matched "from"
[10/5/09 9:20:47:092 EDT] 0000002e WebApp A SRVE0180I:
[Servlet.LOG]:
org.tuckey.web.filters.urlrewrite.Condition DEBUG: evaluating
"localhost:9080" against localhost:9080
[10/5/09 9:20:47:108 EDT] 0000002e WebApp A SRVE0180I:
[Servlet.LOG]:
org.tuckey.web.filters.urlrewrite.Condition DEBUG: evaluating
"localhost:9080" against ^$
[10/5/09 9:20:47:108 EDT] 0000002e WebApp A SRVE0180I:
[Servlet.LOG]:
org.tuckey.web.filters.urlrewrite.Condition DEBUG: not equal operator
in use
[10/5/09 9:20:47:108 EDT] 0000002e WebApp A SRVE0180I:
[Servlet.LOG]:
org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: conditions match
[10/5/09 9:20:47:123 EDT] 0000002e WebApp A SRVE0180I:
[Servlet.LOG]:
org.tuckey.web.filters.urlrewrite.RuleExecutionOutput DEBUG: needs to
be permanentely redirected to http://www.example.com/Applcationcontext/ [10/5/09 9:20:47:483 EDT] 0000002e WebApp A SRVE0180I:
[Servlet.LOG]:
org.tuckey.web.filters.urlrewrite.UrlRewriter DEBUG: rule is last
---
what i understood is , it is not a harm if we have this condition .
am i correct ?
please let me know is it a harm or not if we have this condition in
the rule. if so the below 2 rules are correct to achive(to redirect
www
and non-www url to www).
because that condition is already existed in the application and we
are just following. coming to improve, as you said this is not at all
required because always true. correct ?
You comments are so appreciated AKS.
Regards,
Mahesh.
On Nov 2, 5:07 am, Avlesh Singh <avl...@gmail.com> wrote:
> I tried really hard, but failed to understand the acronym!
> but the below rules were correct or not to achieve the same(to redirect www> and non-www url to www).
> > <condition name="host" operator="equal">www.example.org</condition>
> > <condition name="host" operator="notequal">^$</condition>
> > ...
> I don't think you would achieve what you want with these conditions. What
> makes you think that <condition name="host"
> operator="notequal">^$</condition> would NOT match anything under the sun?
> It is rule which essentially says "*when the host is NOT equal to an empty
> string*". Read the previous statement once more, and you would realize that
> *it is true for all requests *(because every request has a host header). As
> I earlier said, multiple <condition>'s are AND'ed with other, so in effect
> your rule only applies to requests fromwww.example.orgdomain.
> Did I make it clear?
> Please let me know ASAP.
> Your urgency is understood and respected. Queries on this mailing list don't
> go unanswered. Don't get impatient.
> Cheers
> Avlesh
> On Mon, Nov 2, 2009 at 3:13 PM, mahesh
> <hariprasad.kanamarlap...@gmail.com>wrote:
> > Hi,
> > Thanks AKR, but the below rules were correct or not to achieve the
> > same(to redirect www and non-www url to www).
> because that condition is already existed in the application and we are
> just following. coming to improve, as you said this is not at all required
> because always true. correct ?
Yes, the condition (<condition name="host"
operator="notequal">^$</condition>) is always true and hence not required.
It should not matter whether you run your application in localhost or a
named domain.
Cheers
Avlesh
On Mon, Nov 2, 2009 at 4:19 PM, mahesh
<hariprasad.kanamarlap...@gmail.com>wrote:
> when we enter some thing in the host and then checks the condition
> like
> http header!= " " and so the condition is always became TRUE.
> here is a log-
> [10/5/09 9:20:47:092 EDT] 0000002e WebApp A SRVE0180I:
> [Servlet.LOG]:
> org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: matched "from"
> [10/5/09 9:20:47:092 EDT] 0000002e WebApp A SRVE0180I:
> [Servlet.LOG]:
> org.tuckey.web.filters.urlrewrite.Condition DEBUG: evaluating
> "localhost:9080" against localhost:9080
> [10/5/09 9:20:47:108 EDT] 0000002e WebApp A SRVE0180I:
> [Servlet.LOG]:
> org.tuckey.web.filters.urlrewrite.Condition DEBUG: evaluating
> "localhost:9080" against ^$
> [10/5/09 9:20:47:108 EDT] 0000002e WebApp A SRVE0180I:
> [Servlet.LOG]:
> org.tuckey.web.filters.urlrewrite.Condition DEBUG: not equal operator
> in use
> [10/5/09 9:20:47:108 EDT] 0000002e WebApp A SRVE0180I:
> [Servlet.LOG]:
> org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: conditions match
> [10/5/09 9:20:47:123 EDT] 0000002e WebApp A SRVE0180I:
> [Servlet.LOG]:
> org.tuckey.web.filters.urlrewrite.RuleExecutionOutput DEBUG: needs to
> be permanentely redirected to http://www.example.com/Applcationcontext/ > [10/5/09 <http://www.example.com/Applcationcontext/%0A%5B10/5/09>9:20:47:483 EDT] 0000002e WebApp A SRVE0180I:
> [Servlet.LOG]:
> org.tuckey.web.filters.urlrewrite.UrlRewriter DEBUG: rule is last
> ---
> what i understood is , it is not a harm if we have this condition .
> am i correct ?
> please let me know is it a harm or not if we have this condition in
> the rule. if so the below 2 rules are correct to achive(to redirect
> www
> and non-www url to www).
> because that condition is already existed in the application and we
> are just following. coming to improve, as you said this is not at all
> required because always true. correct ?
> You comments are so appreciated AKS.
> Regards,
> Mahesh.
> On Nov 2, 5:07 am, Avlesh Singh <avl...@gmail.com> wrote:
> > > Thanks AKR
> > I tried really hard, but failed to understand the acronym!
> > but the below rules were correct or not to achieve the same(to redirect
> www> and non-www url to www).
> > > <condition name="host" operator="equal">www.example.org</condition>
> > > <condition name="host" operator="notequal">^$</condition>
> > > ...
> > I don't think you would achieve what you want with these conditions. What
> > makes you think that <condition name="host"
> > operator="notequal">^$</condition> would NOT match anything under the
> sun?
> > It is rule which essentially says "*when the host is NOT equal to an
> empty
> > string*". Read the previous statement once more, and you would realize
> that
> > *it is true for all requests *(because every request has a host header).
> As
> > I earlier said, multiple <condition>'s are AND'ed with other, so in
> effect
> > your rule only applies to requests fromwww.example.orgdomain.
> > Did I make it clear?
> > Please let me know ASAP.
> > Your urgency is understood and respected. Queries on this mailing list
> don't
> > go unanswered. Don't get impatient.
> > Cheers
> > Avlesh
> > On Mon, Nov 2, 2009 at 3:13 PM, mahesh
> > <hariprasad.kanamarlap...@gmail.com>wrote:
> > > Hi,
> > > Thanks AKR, but the below rules were correct or not to achieve the
> > > same(to redirect www and non-www url to www).
Please let me know. I think i am asking so many questions. sorry for
that AKS as i can't test it production scenarios in the localhost for
urlrewrite . Once again thanks for your comments.
Regards,
Mahesh.
On Nov 2, 5:55 am, Avlesh Singh <avl...@gmail.com> wrote:
> > because that condition is already existed in the application and we are
> > just following. coming to improve, as you said this is not at all required
> > because always true. correct ?
> Yes, the condition (<condition name="host"
> operator="notequal">^$</condition>) is always true and hence not required.
> It should not matter whether you run your application in localhost or a
> named domain.
> Cheers
> Avlesh
> On Mon, Nov 2, 2009 at 4:19 PM, mahesh
> <hariprasad.kanamarlap...@gmail.com>wrote:
> > Hi,
> > Thank you so much for your quick reply.
> > i run the same in localhost and it was working fine with the below
> > condition
> > when we enter some thing in the host and then checks the condition
> > like
> > http header!= " " and so the condition is always became TRUE.
> > here is a log-
> > [10/5/09 9:20:47:092 EDT] 0000002e WebApp A SRVE0180I:
> > [Servlet.LOG]:
> > org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: matched "from"
> > [10/5/09 9:20:47:092 EDT] 0000002e WebApp A SRVE0180I:
> > [Servlet.LOG]:
> > org.tuckey.web.filters.urlrewrite.Condition DEBUG: evaluating
> > "localhost:9080" against localhost:9080
> > [10/5/09 9:20:47:108 EDT] 0000002e WebApp A SRVE0180I:
> > [Servlet.LOG]:
> > org.tuckey.web.filters.urlrewrite.Condition DEBUG: evaluating
> > "localhost:9080" against ^$
> > [10/5/09 9:20:47:108 EDT] 0000002e WebApp A SRVE0180I:
> > [Servlet.LOG]:
> > org.tuckey.web.filters.urlrewrite.Condition DEBUG: not equal operator
> > in use
> > [10/5/09 9:20:47:108 EDT] 0000002e WebApp A SRVE0180I:
> > [Servlet.LOG]:
> > org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: conditions match
> > [10/5/09 9:20:47:123 EDT] 0000002e WebApp A SRVE0180I:
> > [Servlet.LOG]:
> > org.tuckey.web.filters.urlrewrite.RuleExecutionOutput DEBUG: needs to
> > be permanentely redirected tohttp://www.example.com/Applcationcontext/ > > [10/5/09 <http://www.example.com/Applcationcontext/%0A%5B10/5/09>9:20:47:483 EDT] 0000002e WebApp A SRVE0180I:
> > [Servlet.LOG]:
> > org.tuckey.web.filters.urlrewrite.UrlRewriter DEBUG: rule is last
> > ---
> > what i understood is , it is not a harm if we have this condition .
> > am i correct ?
> > please let me know is it a harm or not if we have this condition in
> > the rule. if so the below 2 rules are correct to achive(to redirect
> > www
> > and non-www url to www).
> > because that condition is already existed in the application and we
> > are just following. coming to improve, as you said this is not at all
> > required because always true. correct ?
> > You comments are so appreciated AKS.
> > Regards,
> > Mahesh.
> > On Nov 2, 5:07 am, Avlesh Singh <avl...@gmail.com> wrote:
> > > > Thanks AKR
> > > I tried really hard, but failed to understand the acronym!
> > > but the below rules were correct or not to achieve the same(to redirect
> > www> and non-www url to www).
> > > > <condition name="host" operator="equal">www.example.org</condition>
> > > > <condition name="host" operator="notequal">^$</condition>
> > > > ...
> > > I don't think you would achieve what you want with these conditions. What
> > > makes you think that <condition name="host"
> > > operator="notequal">^$</condition> would NOT match anything under the
> > sun?
> > > It is rule which essentially says "*when the host is NOT equal to an
> > empty
> > > string*". Read the previous statement once more, and you would realize
> > that
> > > *it is true for all requests *(because every request has a host header).
> > As
> > > I earlier said, multiple <condition>'s are AND'ed with other, so in
> > effect
> > > your rule only applies to requests fromwww.example.orgdomain.
> > > Did I make it clear?
> > > Please let me know ASAP.
> > > Your urgency is understood and respected. Queries on this mailing list
> > don't
> > > go unanswered. Don't get impatient.
> > > Cheers
> > > Avlesh
> > > On Mon, Nov 2, 2009 at 3:13 PM, mahesh
> > > <hariprasad.kanamarlap...@gmail.com>wrote:
> > > > Hi,
> > > > Thanks AKR, but the below rules were correct or not to achieve the
> > > > same(to redirect www and non-www url to www).
To keep the answer simple - YES. These rules would work without glitches for
you.
But, why don't you consider the one that I sent in my first response. It is
a lot more cleaner and accurate. I am pasting it once more for your
reference -
<rule>
<condition name="host" operator="equal" next="or">www.example.org </condition>
<condition name="host" operator="equal">example.org</condition>
<from>(.*)</from>
<to last="true" type="permanent-redirect">http://www.example.com$1</to>
</rule>
Cheers
Avlesh
On Mon, Nov 2, 2009 at 4:41 PM, mahesh
<hariprasad.kanamarlap...@gmail.com>wrote:
> Please let me know. I think i am asking so many questions. sorry for
> that AKS as i can't test it production scenarios in the localhost for
> urlrewrite . Once again thanks for your comments.
> Regards,
> Mahesh.
> On Nov 2, 5:55 am, Avlesh Singh <avl...@gmail.com> wrote:
> > > because that condition is already existed in the application and we are
> > > just following. coming to improve, as you said this is not at all
> required
> > > because always true. correct ?
> > Yes, the condition (<condition name="host"
> > operator="notequal">^$</condition>) is always true and hence not
> required.
> > It should not matter whether you run your application in localhost or a
> > named domain.
> > Cheers
> > Avlesh
> > On Mon, Nov 2, 2009 at 4:19 PM, mahesh
> > <hariprasad.kanamarlap...@gmail.com>wrote:
> > > Hi,
> > > Thank you so much for your quick reply.
> > > i run the same in localhost and it was working fine with the below
> > > condition
> > > when we enter some thing in the host and then checks the condition
> > > like
> > > http header!= " " and so the condition is always became TRUE.
> > > ---
> > > what i understood is , it is not a harm if we have this condition .
> > > am i correct ?
> > > please let me know is it a harm or not if we have this condition in
> > > the rule. if so the below 2 rules are correct to achive(to redirect
> > > www
> > > and non-www url to www).
> > > because that condition is already existed in the application and we
> > > are just following. coming to improve, as you said this is not at all
> > > required because always true. correct ?
> > > You comments are so appreciated AKS.
> > > Regards,
> > > Mahesh.
> > > On Nov 2, 5:07 am, Avlesh Singh <avl...@gmail.com> wrote:
> > > > > Thanks AKR
> > > > I tried really hard, but failed to understand the acronym!
> > > > but the below rules were correct or not to achieve the same(to
> redirect
> > > www> and non-www url to www).
> > > > > <condition name="host" operator="equal">www.example.org > </condition>
> > > > > <condition name="host" operator="notequal">^$</condition>
> > > > > ...
> > > > I don't think you would achieve what you want with these conditions.
> What
> > > > makes you think that <condition name="host"
> > > > operator="notequal">^$</condition> would NOT match anything under the
> > > sun?
> > > > It is rule which essentially says "*when the host is NOT equal to an
> > > empty
> > > > string*". Read the previous statement once more, and you would
> realize
> > > that
> > > > *it is true for all requests *(because every request has a host
> header).
> > > As
> > > > I earlier said, multiple <condition>'s are AND'ed with other, so in
> > > effect
> > > > your rule only applies to requests fromwww.example.orgdomain.
> > > > Did I make it clear?
> > > > Please let me know ASAP.
> > > > Your urgency is understood and respected. Queries on this mailing
> list
> > > don't
> > > > go unanswered. Don't get impatient.
> > > > Cheers
> > > > Avlesh
> > > > On Mon, Nov 2, 2009 at 3:13 PM, mahesh
> > > > <hariprasad.kanamarlap...@gmail.com>wrote:
> > > > > Hi,
> > > > > Thanks AKR, but the below rules were correct or not to achieve the
> > > > > same(to redirect www and non-www url to www).
> > > > > > > Please help me out as soon as possible as i can't test it in
> local
> > > > > > > host this scenario.
> > > > > > > Regards,
> > > > > > > Mahesh
> > > > > > > On Oct 30, 9:37 am, mahesh <hariprasad.kanamarlap...@gmail.com
> To keep the answer simple - YES. These rules would work without glitches for
> you.
> But, why don't you consider the one that I sent in my first response. It is
> a lot more cleaner and accurate. I am pasting it once more for your
> reference -
> <rule>
> <condition name="host" operator="equal" next="or">www.example.org > </condition>
> <condition name="host" operator="equal">example.org</condition>
> <from>(.*)</from>
> <to last="true" type="permanent-redirect">http://www.example.com$1</to>
> </rule>
> Cheers
> Avlesh
> On Mon, Nov 2, 2009 at 4:41 PM, mahesh
> <hariprasad.kanamarlap...@gmail.com>wrote:
> > Hi,
> > Thanks a lot AKS.
> > so will these rules suffice to archive redirect www and non-www url to
> > www.
> > Please let me know. I think i am asking so many questions. sorry for
> > that AKS as i can't test it production scenarios in the localhost for
> > urlrewrite . Once again thanks for your comments.
> > Regards,
> > Mahesh.
> > On Nov 2, 5:55 am, Avlesh Singh <avl...@gmail.com> wrote:
> > > > because that condition is already existed in the application and we are
> > > > just following. coming to improve, as you said this is not at all
> > required
> > > > because always true. correct ?
> > > Yes, the condition (<condition name="host"
> > > operator="notequal">^$</condition>) is always true and hence not
> > required.
> > > It should not matter whether you run your application in localhost or a
> > > named domain.
> > > Cheers
> > > Avlesh
> > > On Mon, Nov 2, 2009 at 4:19 PM, mahesh
> > > <hariprasad.kanamarlap...@gmail.com>wrote:
> > > > Hi,
> > > > Thank you so much for your quick reply.
> > > > i run the same in localhost and it was working fine with the below
> > > > condition
> > > > when we enter some thing in the host and then checks the condition
> > > > like
> > > > http header!= " " and so the condition is always became TRUE.
> > > > ---
> > > > what i understood is , it is not a harm if we have this condition .
> > > > am i correct ?
> > > > please let me know is it a harm or not if we have this condition in
> > > > the rule. if so the below 2 rules are correct to achive(to redirect
> > > > www
> > > > and non-www url to www).
> > > > because that condition is already existed in the application and we
> > > > are just following. coming to improve, as you said this is not at all
> > > > required because always true. correct ?
> > > > > I tried really hard, but failed to understand the acronym!
> > > > > but the below rules were correct or not to achieve the same(to
> > redirect
> > > > www> and non-www url to www).
> > > > > > <condition name="host" operator="equal">www.example.org > > </condition>
> > > > > > <condition name="host" operator="notequal">^$</condition>
> > > > > > ...
> > > > > I don't think you would achieve what you want with these conditions.
> > What
> > > > > makes you think that <condition name="host"
> > > > > operator="notequal">^$</condition> would NOT match anything under the
> > > > sun?
> > > > > It is rule which essentially says "*when the host is NOT equal to an
> > > > empty
> > > > > string*". Read the previous statement once more, and you would
> > realize
> > > > that
> > > > > *it is true for all requests *(because every request has a host
> > header).
> > > > As
> > > > > I earlier said, multiple <condition>'s are AND'ed with other, so in
> > > > effect
> > > > > your rule only applies to requests fromwww.example.orgdomain.
> > > > > Did I make it clear?
> > > > > Please let me know ASAP.
> > > > > Your urgency is understood and respected. Queries on this mailing
> > list
> > > > don't
> > > > > go unanswered. Don't get impatient.
> > > > > Cheers
> > > > > Avlesh
> > > > > On Mon, Nov 2, 2009 at 3:13 PM, mahesh
> > > > > <hariprasad.kanamarlap...@gmail.com>wrote:
> > > > > > Hi,
> > > > > > Thanks AKR, but the below rules were correct or not to achieve the
> > > > > > same(to redirect www and non-www url to www).