通过重定向某些变量的任何页面 [英] Redirect any page passing certain variables

查看:151
本文介绍了通过重定向某些变量的任何页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我把我的网站上的搜索引擎,而搜索框出现在多个不同的页面。 输出看起来是这样的: http://mysite.com/mypage ?.PHP bluepart =搜索和;关键词=狗和放大器;去=去 我试图做一个.htaccessmod-rewrite的地方可以通过这些变量中的任何页面重定向到search_results.php。该bluepart =搜索并进入= Go会始终是相同的,但关键字可以是任何数字或单词。此外,我的一些网页html的,有些是.PHP,当我指的是通过变量。任何网页

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.

推荐答案

看看的的的RewriteCond 选项。它允许你指定一个重写如果一个正规的前pression查询字符串(QUERY_STRING)相匹配。

Take a look at the RewriteCond option. It allows you to specify a rewrite if an regular expression matches the Query string (QUERY_STRING).

这篇关于通过重定向某些变量的任何页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆