Re: mod_rewrite starts driving me crazy ...

From: Date: Sun, 11 Feb 2001 08:45:03 +0000
Subject: Re: mod_rewrite starts driving me crazy ...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39110@lists.php.net to get a copy of this message
> This works perfectly, however what I really need to do is to make it work > not only with /index.html but with everything typed in your browser... > (index.html was only a test to let me know I am in a right direction) > > I tried: > > RewriteRule ^(.*) /start.php?go=$1 > RewriteRule ^(.*)$ /start.php?go=$1 > RewriteRule ^(.+) /start.php?go=$1 > RewriteRule ^(.+)$ /start.php?go=$1 > > RewriteRule ^(/.*) /start.php?go=$1 > RewriteRule ^(/.*)$ /start.php?go=$1 > RewriteRule ^(/.+) /start.php?go=$1 > RewriteRule ^(/.+)$ /start.php?go=$1 Having just spent about 16 hours fighting with mod_rewrite to try and replace broken DefaultType on FreeBSD, I feel your pain :-) My thinking in this case is: It really doesn't make sense to have either ^ or $ here, since you really don't care what you start or end with. So, you probably just want: RewriteRule (.*) /start.php?go=$1 Except, of course, that will be an infinite loop, since that matches start.php?go=index.html as well. So, what I think you *really* want is: RewriteRule ^/start\.php.* - [L] RewriteRule (.*) /start.php?go=$1 Translation: #1 If we are surfing to "/start.php?blahblahblah", then use the URL as-is "-" and stop playing these silly rewrite games "[L]" #2 Any URL that reaches this rule, wasn't one of our start.php hacks, so redirect to start.php You may need or want a [R] on the end of that second rule... -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#39110) next »