Forum Moderators: phranque

Message Too Old, No Replies

A little help w/ mod_rewrite and cgi-bin

         

georgiek50

8:44 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



I have gotten mod_rewrite to do everything I need in my .htaccess file so far except for one thing. I am in the process of switching servers and at my old box every download link looks like this:

[mydomain.com...]

I am trying to rewrite this with no success. Here is what I am using:

RewriteEngine on
RewriteBase /
RewriteRule ^/cgi-bin/countdown\.cgi\?MyFile1_0\.zip$ getfile.php?id=6 [L]

I have also tried this:

RewriteRule ^cgi-bin/countdown\.cgi\?MyFile1_0\.zip$ getfile.php?id=6 [L]

I keep getting the dreaded 404, can someone point me in the right direction? Thanks in advance.

jdMorgan

9:07 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



georgiek50,

In simplest form, and assuming I understand your goal correctly, this might work. The trick is that RewriteRule cannot "see" query strings, as they are *not* part of a formal URL, but rather specify data to be passed to the resource handler at a URL:


RewriteEngine on
RewriteCond %{QUERY_STRING} ^MyFile1_0\.zip$
RewriteRule ^cgi-bin/countdown\.cgi$ /getfile.php?id=6 [L]

If that doesn't help, then please repost and define the relationship between "Myfile1_0.zip" and "id=6" as well as the way in which the values of those parameters might vary.

Jim

georgiek50

9:25 pm on Mar 23, 2004 (gmt 0)

10+ Year Member



That's perfect, thank you very much. I didn't realize the rule with the query string.