使用 51° 重定向到移动子域

发布于 2024-12-05 00:07:02 字数 844 浏览 3 评论 0原文

我正在使用 51 Degrees API 进行移动重定向: http://51 Degrees.codeplex.com/

当使用 51°s 检测到移动设备时,我可以仅使用 51°s 配置从任何桌面页面重定向到移动主页。即 http://www.mydomain.com/somepagehttp://m.somepage.com/default

我无法做的是重定向到同一页面,即从 http://www.mydomain.com/somepage< /a> 到 http://m.somepage.com/somepaage

是否可以重定向到同一页面?

I'm using the 51degrees API for mobile redirection: http://51degrees.codeplex.com/

When a mobile device is detected, using 51degrees, I am able to redirect from from any desktop page to the mobile homepage using the 51degrees configuration only. I.e. http://www.mydomain.com/somepage to http://m.somepage.com/default.

What I am unable to do is redirect to the same page, i.e. from http://www.mydomain.com/somepage to http://m.somepage.com/somepaage.

Is it possible to redirect to the same page?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦幻之岛 2024-12-12 00:07:02

选项 1:仅对移动检测部分使用 51 度,并自行连接重定向。从 web.config 中删除 元素,并在 Global.asax 文件中尝试类似的操作:

void Application_BeginRequest(object sender, EventArgs e)
{
    if (HttpContext.Current.Request.Browser.IsMobileDevice)
    {
        Response.Redirect("http://m.mydomain.com" + Request.RawUrl);
    }
}

选项 2:在 中在 web.config 文件中的 元素中,添加属性 originalUrlAsQueryString=true。这会将名为 origUrl 的查询字符串发送到移动主页,让您可以选择重定向到所请求页面的移动版本。

Option 1: Use 51degrees for the mobile detection part only and wire up the redirect yourself. Remove the <redirect> element from your web.config and try something like this in your Global.asax file:

void Application_BeginRequest(object sender, EventArgs e)
{
    if (HttpContext.Current.Request.Browser.IsMobileDevice)
    {
        Response.Redirect("http://m.mydomain.com" + Request.RawUrl);
    }
}

Option 2: In the <redirect> element in the web.config file, add the property originalUrlAsQueryString=true. This will send a query string called origUrl to the mobile homepage giving you the option to redirect to the mobile version of the requested page.

红颜悴 2024-12-12 00:07:02

您可以在 51Degrees.mobi 用户指南

You can find information about how to configure it to redirect to mobile versions of a page in section 2.1.2 in 51Degrees.mobi User Guide.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文