views:

16

answers:

1

This ought to be a simple exercise in Apache with mod_rewrite and all of it's flexibility. I have verified the Rewrite module is working with full logging but no matter how I shake out my rules and conditions, I can't get it to work.

What I want is to rewrite the following url:

http://www.domain.com/search?x=10&y=10&query=search+text

to convert to:

http://www.domain.com/search?query=search+text

... in the location/address bar of the browser so as to remove the stupid x y coordinate values that are there because of an image submit button. Every little bit of url cleansing helps for good SEO practices.

Here is what I have in my httpd-vhosts.conf in /etc/apache2/extra folder on Snow Leopard OS X...

RewriteCond %{QUERY_STRING} ^query=(.*)$ [NC]
RewriteRule ^search /search?query=%1? [L]

Any advice would be much appreciated.

Thanks!

A: 

you should remove the ^ before the query, otherwise it don't match the x=10&y=10&query=search+text

RewriteCond %{QUERY_STRING} query=(.*)$ [NC]
RewriteRule ^/search /search?query=%1? [L]
icyfeel