Re: Mod Rewrite help

From: Date: Tue, 29 Mar 2005 01:42:29 +0000
Subject: Re: Mod Rewrite help
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-211742@lists.php.net to get a copy of this message
Brian Dunning wrote:
How would I mod_rewrite a request for /baseball.htm into /query.php?q=baseball?
This should be doing it as far as I can tell, but for some reason it's not... RewriteEngine on RewriteRule /^(.+).htm$ /query.php?q=$1
RewriteEngine on RewriteRule ^/(.+)\.htm$ /query.php?q=$1 But note this isn't good.. since say if you got a regular page /index.htm then it will be rewritten into /query.php?q=index so what you better do is having a prefix of a 'virtual' directory, like was suggested before 'sport'... and make it like this: RewriteEngine on RewriteRule ^/sport/(.+)\.htm$ /query.php?q=$1 -Eli.

« previous php.general (#211742) next »