Re: [PHP] Mod Rewrite help
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mod Rewrite help
I know this isn't exactly a PHP question, but it's for a PHP site if that helps :) :) How would I mod_rewrite a request for /baseball.htm into /query.php?q=baseball? - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mod Rewrite help
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Mod Rewrite help
RD Definitely more than one way to skin this cat, but the following will RD work: RD RewriteEngine on RD RewriteRule ^baseball.htm/ /query.php?q=baseball [L] Erm, self-correcting myself here - don't have the / after .htm! 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mod Rewrite help
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mod Rewrite help
RewriteEngine on RewriteRule /^(.+).htm$ /query.php?q=$1 AFAIK you should have that space at the end of your regex after the $ HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mod Rewrite help
Mikey wrote: RewriteEngine on RewriteRule /^(.+).htm$ /query.php?q=$1 ^-- this slash looks to me like its in the wrong place. AFAIK you should have that space at the end of your regex after the $ HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php