帮助重定向和查询字符串
我在 mod 重写方面完全是新手,所以我会尝试尽可能清楚地提出我的问题:
我正在尝试创建以下(静态)附属网址的网址重定向,该网址可以将其自身附加到之后的任何产品链接中使用查询字符串:
附属网址: hxxp://clk.affilite.com/fs-bin/click?id=aFb*BBBBBpQ&subid=&offerid=9999.2&type=5&tmpid=9999&RD_PARM1=
产品网址: hxxp:// example.domain.com
我想要实现的是重定向联属代码,如下所示,并能够在之后添加动态产品网址,如下例所示:
重写联属网址: hxxp://domain.com/go
附属网址 + 产品网址: hxxp://domain.com/go?=http://example.domain.com
重定向到: hxxp://clk.affilite.com/fs-bin/click?id=aFb*BBBBBpQ&subid=&offerid=9999.2&type=5&tmpid=9999&RD_PARM1=http://example.domain.com
编辑:
好的,开始使用以下建议到达某处,如下所示:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^=([^&]*)$
RewriteRule ^/?yo$ hxxp://google.com%1 [R,L]
访问: hxxp://domain.com/yo?=hxxp://product.com
输出: hxxp://www.google.comhxxp//product.com?=hxxp://product.com
它将产品网址保留在重定向网址的末尾,如果网址后面有其他 = 符号,它还会给出 404有哪些。
I'm a total novice at mod rewrite so I'll try and present my question as clearly as possible:
I'm trying to create a url redirect of the following (static) affiliate url that can append it self to any product links after using a query string:
affiliate url:
hxxp://clk.affilite.com/fs-bin/click?id=aFb*BBBBBpQ&subid=&offerid=9999.2&type=5&tmpid=9999&RD_PARM1=
product url:
hxxp:// example.domain.com
What I want to achieve is redirecting the affiliate code as below and being able to add dynamic product urls after as the following examples show:
rewritten affiliate url:
hxxp://domain.com/go
affiliate url + product url:
hxxp://domain.com/go?=http://example.domain.com
redirects to:
hxxp://clk.affilite.com/fs-bin/click?id=aFb*BBBBBpQ&subid=&offerid=9999.2&type=5&tmpid=9999&RD_PARM1=http://example.domain.com
EDIT:
Ok starting to get somewhere using the below suggestion as follows:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^=([^&]*)$
RewriteRule ^/?yo$ hxxp://google.com%1 [R,L]
Visiting:
hxxp://domain.com/yo?=hxxp://product.com
Outputs:
hxxp://www.google.comhxxp//product.com?=hxxp://product.com
it keeps the product url at the end of the redirected url it also gives a 404 if there are additional = symbols later in the url which there are.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)