Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9159393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:28:53+00:00 2026-06-17T13:28:53+00:00

I have a rewrite that is set up to handle multiple different user agents,

  • 0

I have a rewrite that is set up to handle multiple different user agents, and I want to be able to match my rule on any of them. However, any url that matches one of these must also match another rule (an IP address). However, I can’t find any documentation on how to do this. Can anyone make any suggestions on how I can do this?

Below is an example of what I’m trying to achieve. I know that this will fail because the conditions node has already been declared more than once.

So, in essence it’s a redirect when any of the {HTTP_USER_AGENT} rules and any of the {REMOTE_ADDR} rules are matched.

<rule name="Mobile UA redirect" stopProcessing="true">
  <match url="(.*)" />
  <conditions logicalGrouping="MatchAny">
    <!-- Any of these can be matched -->
    <add input="{HTTP_USER_AGENT}" pattern="Android" />
    <add input="{HTTP_USER_AGENT}" pattern="BlackBerry" />
    <!-- ... more user agents... -->
  </conditions>
  <!-- Here, similarly, any one of these rules can be matched, but one of the rules above must also match one of the rules below. -->
  <conditions logicalGrouping="MatchAny">
    <add input="{REMOTE_ADDR}" pattern="127.0.0.1" />
    <add input="{REMOTE_ADDR}" pattern="192.168.0.1" />
  </conditions>
  <action type="Redirect" url="http://mob.mydomain.com/{R:0}" appendQueryString="true" />
</rule>

Any help on how I can do this would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:28:54+00:00Added an answer on June 17, 2026 at 1:28 pm

    What about smth like the following, placed at the bottom:

    <rule name="MobileRestricted" stopProcessing="true">
      <match url="(.*)" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REMOTE_ADDR}" pattern="127.0.0.1" negate="true" />
        <add input="{REMOTE_ADDR}" pattern="192.168.0.1" negate="true" />        
      </conditions>
      <action type="None"/>
    </rule>
    <rule name="Mobile UA redirect" stopProcessing="true">
      <match url="(.*)" />
      <conditions logicalGrouping="MatchAny">
        <!-- Any of these can be matched -->
        <add input="{HTTP_USER_AGENT}" pattern="Android" />
        <add input="{HTTP_USER_AGENT}" pattern="BlackBerry" />
        <!-- ... more user agents... -->
      </conditions>
      <action type="Redirect" url="http://mob.mydomain.com/{R:0}" appendQueryString="true" />
    </rule>
    

    Not a single rule, but no more than two )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of functions that handle the db connection. I want to
I think this may be relatively straight forward. I have a rewrite rule that
I have the following rewrite rule that I need to alter in order to
I have a mod_rewrite rule that will send any subdomain requests to a php
I have a set of rewrite rules that are supposed to process a URL
Say I have a rewrite that needs to pass the url to a PHP
I have a custom HttpModule rewrite engine in an existing web application project that
We have the following rewrite rule: RewriteRule ^([A-Za-z0-9\_]+)$ index.php?rewrite=$1 [L,QSA] We were wondering if
I have .htaccess currently set up to rewrite anything without a period or slash
I have a rewrite rule, which changes a server variable with the value of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.