I\' trying to rewrite 1 dynamic URL to another dynamic URL as follows;
/category?category=News to
/categorysearch/result/?q=news
I was wond
Depending on what you're trying to do and how specific things need to be, there are two options.
The first is Rob W's solution, which should redirect the user from /category?category=News
to /categorysearch/result/?q=News
If, as it appears, your URLs are case-sensitive, you might want to look at a PHP script like the following:
$matches = array();
if( preg_match( "/^/category\?category=(.+)/", $_SERVER['REQUEST_URI'], $matches ) ) {
header( 'Location: http://' . $_SERVER['HTTP_HOST'] . '/categorysearch/result/?q= . strtolower($matches[1]) );
}
else {
//ERROR HANDLING
}
Once that's settled, you can use a rule like the following to redirect using a fully lowercase parameter.
RewriteRule ^category\?category=(.+)$ redirect.php [L]
Put together, this solution would redirect /category?category=News
to /categorysearch/result/?q=news