Re: Mod Rewrite help
| From: | Richard Davey | Date: | Mon, 21 Mar 2005 18:11:54 +0000 |
| Subject: | Re: Mod Rewrite help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-211202@lists.php.net to get a copy of this message | ||
Hello Brian,
Monday, March 21, 2005, 6:05:59 PM, you wrote:
BD> I know this isn't exactly a PHP question, but it's for a PHP site if
BD> that helps.... :) :)
BD> How would I mod_rewrite a request for /baseball.htm into
BD> /query.php?q=baseball?
Definitely more than one way to skin this cat, but the following will
work:
RewriteEngine on
RewriteRule ^baseball.htm/ /query.php?q=baseball [L]
If you want to make it a bit more dynamic you could do this:
RewriteRule ^sport/(.*)$ /query.php?q=$1 [L]
Then you can do sport/baseball.htm or sport/football.htm and it'll be
passed to query.php each time.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov