Permanent Redirect with Parameters

此生再无相见时 提交于 2019-12-13 04:26:00

问题


Is there any way to permanently redirect a domain to another domain with a corresponding parameter?

For example, somebody visits example.com, which permanently redirects to eg.com/?url=example.

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.

Is there any way to do this with htaccess?


回答1:


Escape backslash before question mark.

RewriteRule ^/?$ "https\:\/\/eg\.com\/\?url=example" [R=301,L]
#                                     ^ add backslash here


来源:https://stackoverflow.com/questions/57385741/permanent-redirect-with-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!