How to exclude certain domains

Splash Forums Rewrite Users How to exclude certain domains

This topic contains 4 replies, has 2 voices, and was last updated by  captainmorgan 2 years, 8 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #25396

    captainmorgan
    Participant

    I have the following join:
    builder.addRule(Join.path(“/en/contact-us.html”).to(“/faces/aboutus/contact_us.xhtml”)).when(????????????);

    I want the rule applied when the domain is not “www.domain1.com” and not “www.domain2.com”.
    How do I write this?

    #25397

    Try:

    .when(
       Domain.matches("domain1")
    )
    #25398

    captainmorgan
    Participant

    Doesn’t that mean that the rule should apply when the domain matches domain1? I want the rule to apply when the domain is not domain1 or domain2.

    #25399

    Oh whoops 🙂

    .when(
       Not.any(Domain.matches("domain1")
          .or(Domain.matches("domain2"))
       )
    )

    There you go!

    Keep in mind, you can also parameterize the domains:

    .when(
       Not.any(Domain.matches("{domain}"))
    )
    .where("domain").matches("domain(1|2).*")

    This allows you to use regular expressions 🙂

    #25400

    captainmorgan
    Participant

    Great. Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Comments are closed.