Forum Moderators: phranque
I've tried multiple different rewriterules, but nothing seems to work...
the foo.com/?product=product-name-goes-here&page=overview page already exists
RewriteRule ^? blahblah
is a 500-class error. Did something get lost in the copy-and-paste?
RewriteCond %{QUERY STRING} patternblahblah
RewriteRule ^(index\.\w+)?$ targetblahblah%1blahblah
But before we can hammer out the exact form of the "patternblahblah", we need to work out in english what all possible inputs are. page=something&product=something-else
? Even if your code is set up so things always come in the same order, you have to allow for type-ins and possibly search engines. RewriteCond %{QUERY_STRING} ^(product=[^&]*)&page=(?:benefits|features|documents)
RewriteRule ^(index\.\w+)?$ http://www.example.com/?%1&page=overview [R=301,L]
RewriteCond %{QUERY_STRING} ^page=(?:benefits|features|documents)&(product=.*)
RewriteRule ^(index\.\w+)?$ http://www.example.com/?%1&page=overview [R=301,L]
Note that with ?: for non-capturing group, the two rules are identical; only the condition looking at the query string is different. RewriteCond %{QUERY_STRING} !page=overview(&|$)
RewriteCond %{QUERY_STRING} (product=[^&]*)
RewriteRule ^(index\.\w+)?$ http://www.example.com/?%1&page=overview [R=301,L]
This version means "if the 'page' parameter is absent entirely, or its value is anything other than the exact string 'overview'".