【发布时间】:2021-12-04 13:31:18
【问题描述】:
我想重定向到另一个网站,并传递参数。
示例:我访问我的网站:source.example/?code=12345
然后,我希望它重定向到target.example/?code=12345。
我目前正在将它用于我的.htaccess 文件,因为我从其他帖子中发现,如果我查询某个参数,它也会被传递:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^code=[NS]$
RewriteRule "www.google.com" /$1 [R=302,L]
此外,我尝试了许多不同的方法来查看这些堆栈问题:
- simple .htaccess redirect : how to redirect with parameters?
- Redirect and keep the parameter in the url on .htaccess
但我无法让它运行:(
【问题讨论】:
-
你说你“不能传递参数”,但你发布的指令不会做任何事情?
标签: apache .htaccess url mod-rewrite cpanel