Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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.