I need to create a link_to to a different subdomain.
This is what I came up with:
= link_to "Link to Subdomain", root_path(subdomain: "abc", param1: "value1", param2: "value2")
It is not working though. I get redirected to:
http://lvh.me:3000/?param1=value1¶m2=value2
Note: The as param passed subdomain
is not being displayed in the url. Neither as subdomain nor as parameter.
Instead I want to get redirected to the following URL:
http://abc.lvh.me:3000/?param1=value1¶m2=value2
啊...你正在使用root_path
,根据定义它是一个相对url(即它不包含域)...你可能想要root_url
,它将完全指定域(和子域)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.