1
votes

I have two rewrite conditions.

Condition A

RewriteCond %{HTTP_HOST} ^mobile.nu$ [NC]

Condition B

RewriteCond %{HTTP_USER_AGENT} (android|blackberry|iphone|ipod|windows\ phone) [NC]

Rewrite Rule.

RewriteRule ^foo.html$

Now I want to write some condition like this.

If Condition A AND Condition B then redirect to the given rule

Can some one tell me how to achieve that

2

2 Answers

1
votes

You can use this rule:

RewriteCond %{HTTP_HOST} ^mobile\.nu$ [NC]
RewriteCond %{HTTP_USER_AGENT} (android|blackberry|iphone|ipod|windows\ phone) [NC]
RewriteRule ^foo.html$ /mobil/index.html [L]

condition1 and condition2 will be ANDed together.

Though your RewriteRule is not complete in your question.

1
votes

You just write those conditions in order before the rule:

RewriteCond %{HTTP_HOST} ^mobile.nu$ [NC]
RewriteCond %{HTTP_USER_AGENT} (android|blackberry|iphone|ipod|windows\ phone) [NC]
RewriteRule ^foo.html$ [rewrite rule]

That imposes an AND relationship between the two conditions