Posted by Eli on 03/29/05 04:42
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.
[Back to original message]
|