Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite rule not working

... seems like apache started drinking :)

         

trappy

11:05 pm on Apr 10, 2004 (gmt 0)

10+ Year Member



ok, I know this will definately knock some of you off the chair, but here goes (and as unbelievable as it is, I tested it several times and 2 friends witnessed it)

First of all this is the rewrite rule I was planning to install.

RewriteRule ^/file/([0-9]*)$ /file.php?fid=$1

Whatever is wrong here, I don't know. All I know is that it worked before our reboot and now it doesn't anymore. Well, it works (the redirection to file.php) but fid doesn't get passed along. a print_r($_REQUEST) showed no sign of fid in the request array, so either it's empty or not getting passed along at all. I'm guessing that the rewrite rule got triggered but $1 just didn't contain anything - in the eyes of a drunken apache webserver, at least ;) Nevertheless this rewrite rule was thoroughly checked over the past 4-5 hours and to my mind it is correct (PLEASE correct me if I'm wrong... I beg you hehe)

The thing that gets me is that below rewrite rules work (although it's ugly)

RewriteRule ^/file/1$ /file.php?fid=1
RewriteRule ^/file/2$ /file.php?fid=2
RewriteRule ^/file/3$ /file.php?fid=3
RewriteRule ^/file/4$ /file.php?fid=4

Anyways, since I only have about 800 files that are referenced that way, I took it upon myself to put one RewriteRule for each of them for now (the show must go on!) but if any of you guys could help me solve the problem I'd be so greatful! The problem was causing the three of us such a headache because it worked before we rebooted the box (we updated the kernel, other than that NOTHING was changed o_O)

Cheers,

Raphael Pirker

trappy

11:18 pm on Apr 10, 2004 (gmt 0)

10+ Year Member



NOTE: the most funny thing I forgot to mention - If I disable the RewriteEngine AND remove the rewrite rule I don't get a 404 error... no... it still rewrites... Even now that I have replaced the old rewrite rule with the 800 static ugly ones, entering an invalid ID redirects to the file.php.