我需要将具有移动用户代理的任何人重定向到名为 mobile.php 的文件。
我的网络托管提供商 Net Registry 使用 Zeus Web 服务器。
这是我根据研究编写的脚本
RULE_1_START:
# get the document root
map path into SCRATCH:DOCROOT from /
match IN:User-Agent into $ with iPad|iPod|iPhone|Android|s+Mobile
if matched then
set OUT:Location = /mobile.php
endif
RULE_1_END:
我用的是我的房东网站上的说明 http://www.netregistry.com.au/support/articles/drupal-clean-urls-rewrite#Zues.
我将其粘贴到他们的控制台中,它可以进行重定向。 Net 注册表有一些您提交的奇怪控制台内容,并且需要 10 分钟才能更新 zeus 服务器配置(非常烦人)。
无论如何,我的问题是它将我重定向到错误的位置:
因此,如果您使用包含以下内容的用户代理字符串访问该网站ipad|ipod|android|\s+mobile
然后你就会触发它()
它带我到这里:
http://example.com.au/mobile.php,%20catalog/index.php
我不知道如何解决这个问题,或者为什么会发生这种情况,因为目前这个文件存在:
http://example.com.au/mobile.php
就像这个一样:
http://example.com.au/index.php. Contents of this file are:
<?php header("Location: catalog/index.php");
关于如何使这项工作更像 apache .htaccess url 重写的任何想法?
Zeus 官方文档 http://support.zeus.com/zws/media/docs/4.3/ZWSUserGuide.pdf