从具有参数的URL重定向到另一个网站 [英] redirect to another site from the URL with argument

查看:93
本文介绍了从具有参数的URL重定向到另一个网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

redirect /index.php?categoryID=647 http://other_site.ru/

这是precisely这一类店的引用到另一个站点。在这种形式下,不能正常工作。我怀疑,这个问题是由于一个参数。如何做正确的事? 对不起,我的英文不好(谷歌翻译)

That is precisely this category store a reference to another site. In this form, does not work. I suspect that the problem is due to an argument. How to do the right thing? Sorry for bad english (google translator)

推荐答案

您不能针对重定向的查询字符串相匹配。你需要使用mod_rewrite和比赛反对%{QUERY_STRING} 变量:

You can't match against the query string in a redirect. You need to use mod_rewrite and match against the %{QUERY_STRING} variable:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^categoryID=647$
RewriteRule ^index\.php$ http://other_site.ru/? [L,R]

这篇关于从具有参数的URL重定向到另一个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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