Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} =sdmon=software_download/software1.exe
RewriteRule ^index.php$ [L,R=301]
RewriteCond %{QUERY_STRING} =sdmon=software_download/software2.exe
RewriteRule ^index.php$ [L,R=301]

These rules redirect to ....

My question is : How to combine the 2 sets of rules into a single one.

share|improve this question
Is the second rule supposed to go to software2.exe, not just software2? – Shane Madden Jan 23 '12 at 4:00
sorry for missing exe . ive fixed that. Have u got any idea? – user107937 Jan 23 '12 at 5:13

Try this:

RewriteCond %{QUERY_STRING} ^sdmon=software_download/software(\d+)\.exe$
RewriteRule ^index.php$ [L,R=301]

That'll work for software1, software5600, and anywhere else in between.


For any exe name, try this:

RewriteCond %{QUERY_STRING} ^sdmon=software_download/([^/\.]+)\.exe$
RewriteRule ^index.php$ [L,R=301]
share|improve this answer
thanks! What if hello.exe hi.exe ladygaga.exe ? I mean, not the number variation, but different exe name. O(∩_∩)O~ – user107937 Jan 23 '12 at 7:52
@Chang See edit. – Shane Madden Jan 23 '12 at 15:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.