【发布时间】:2012-08-20 14:03:04
【问题描述】:
我已经彻底搜索了一个类似的主题,但找不到一个。在此希望有人能提供帮助。
=> 设置:
我正在使用我在野外发现的 .htaccess 移动重定向。
重定向将移动设备上的访问者从 www.MYSITE.com 发送到 m.MYSITE.com(一个简单的 .html“启动页面”)。在此移动版本上,访问者可以使用链接继续访问完整网站:
<a href="http://www.MYSITE.com">Visit Full Version</a>
=> 问题:
用户从搜索引擎访问 www.MYSITE.com/page。用户被重定向到 m.MYSITE.com 的移动启动页面,然后他们单击“访问完整版”链接。它们不会被重定向到 www.MYSITE.com/page 的完整站点版本,而是被发送到 www.MYSITE.com。
我需要访问者能够从 m.MYSITE.com 初始页面“查看完整”返回到最初请求的 URL(例如 www.MYSITE.com/page 甚至 www.MYSITE.com/page/post)版本”链接。
我的 .htaccess 代码如下:
# If you're not already on m.YOUR_DOMAIN_NAME.com,
# and if you're on a mobile device,
# and if you just got here (didn't get here by clicking links on YOUR_DOMAIN_NAME.com),
# and if you're not just looking for pictures
# then go to the mobile site instead
RewriteCond %{HTTP_HOST} !^m\.MYSITE\.com [NC]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|webos|googlebot-mobile" [NC]
RewriteCond %{REQUEST_URI} !\.(jpg|png|gif)$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*).MYSITE.com/.*$ [NC]
RewriteRule ^(.*)$ http://m.MYSITE.com [L,R=302]
=> 问题:
我可以在我的 .htaccess 文件和/或移动 index.php 中进行哪些操作,以将访问者作为“访问完整版”链接返回到他们最初请求的 URL?
非常感谢任何帮助!
谢谢, 布赖恩
【问题讨论】: