问题
I'm putting a search engine on my site, and the search box appears on several different pages. The output looks like this: http://mysite.com/mypage.php?bluepart=search&keywords=dogs&go=Go I'm trying to do an .htaccess mod rewrite to where any page that passes these variables will get redirected to search_results.php. The bluepart=search and go=Go will always be the same, but keywords can be any number or words. Also, some of my pages are .html and some are .php, when I refer to any page that passes the variables.
回答1:
Take a look at the RewriteCond option. It allows you to specify a rewrite if an regular expression matches the Query string (QUERY_STRING).
来源:https://stackoverflow.com/questions/7310330/redirect-any-page-passing-certain-variables