带有参数的永久重定向 [英] Permanent Redirect with Parameters
本文介绍了带有参数的永久重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用相应的参数将一个域永久重定向到另一个域?
例如,有人访问了 example.com
,它将永久重定向到 eg.com/?url=example
。
For example, somebody visits example.com
, which permanently redirects to eg.com/?url=example
.
我尝试了 RewriteRule ^ /?$ https\:\ / \ / eg\.com\ /?url = example [R = 301,L ]
,尽管确实确实重定向到了 eg.com
,但它显然忽略了参数。
I've tried RewriteRule ^/?$ "https\:\/\/eg\.com\/?url=example" [R=301,L]
, and, although it does indeed redirect to eg.com
, it obviously ignores the parameters.
是否可以通过 htaccess
来做到这一点?
Is there any way to do this with htaccess
?
推荐答案
在问号前转义反斜杠。
RewriteRule ^/?$ "https\:\/\/eg\.com\/\?url=example" [R=301,L]
# ^ add backslash here
这篇关于带有参数的永久重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文