1.将手机域名绑定到主机上
2.通过ftp工具或文件管理 添加重写规则 (其中wap.xxx.com替换为您的域名,红色部分是需要手机访问自动跳转才加上)
windows 2003:
在主机控制面板-isapi筛选器中启用自定义url静态化支持
将以下内容添加到主机others/discuz/httpd.conf文件中
RewriteCond %{HTTP_HOST} ^wap.xxx.com$ [NC]
RewriteCond %{REQUEST_URI} !(photo|news|page|product|advs)/ [NC]
RewriteRule ^(.*)$ /wap/$1 [L]
RewriteCond %{HTTP_HOST} !^wap.xxx.com$ [NC]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera\ mobile|palmos|webos" [NC]
RewriteRule ^(.*)$ http://wap.xxx.com [L,R=302]
windows 2008:
在主机的wwwroot目录下建立web.config文件内容如下
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WAP">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^wap.xxx.com$" />
<add input="{REQUEST_URI}" pattern="(photo|news|page|product|advs)/" negate="true" />
</conditions>
<action type="Rewrite" url="/wap/{R:1}" />
</rule>
<rule name="WAPAceess">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^wap.xxx.com$" negate="true" />
<add input="{HTTP_USER_AGENT}" pattern="android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera\ mobile|palmos|webos" />
</conditions>
<action type="Redirect" url="http://wap.xxx.com" redirectType="Found" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>