Question: I am new on stackoverflow.com and also in .htaccess.

I just ask one thing:

```
RewriteCond %{QUERY_STRING} ^event_id=156$
RewriteRule ^test1.php?$ /htaccess_test/test.php

RewriteCond %{QUERY_STRING} ^event_id=154$
RewriteRule ^test1.php?$ /htaccess_test/test2.php

```

I just want to merge these two rewrite rules because i have lots of these kinds of rules. So i just want to wrap up these things instead of writing two more lines each and every time for new event\_id.

Can you please tell me how can i write this thing?

Answer: 
As I see, you want to redirect test1.php to test.php or test2.php due to different event\_id.
I don't think you can merge these two rules because the destination is not the same due to different conditions. But you can merge the different event\_id to the same condition, like you want event\_id 156 157 158 to redirect to test.php, want 152 153 154 to redirect to test2.php, you can write this way:

```
RewriteCond %{QUERY_STRING} ^event_id=156$
RewriteCond %{QUERY_STRING} ^event_id=157$
RewriteCond %{QUERY_STRING} ^event_id=158$
RewriteRule ^test1.php?$ /htaccess_test/test.php

RewriteCond %{QUERY_STRING} ^event_id=152$
RewriteCond %{QUERY_STRING} ^event_id=153$
RewriteCond %{QUERY_STRING} ^event_id=154$
RewriteRule ^test1.php?$ /htaccess_test/test2.php

```

Hope this help you more or less.
Try this combined code in your .htaccess file:

```
Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteCond %{QUERY_STRING} ^event_id=(156|154)$ [NC]
RewriteRule ^test1\.php/?$ /htaccess_test/test.php [NC,L]

```