Bind a domain name to the mobile site of 成品网站 through the rewrite component.
Published: 2014-08-22
1. Bind the mobile domain to the host
2. Through ftp tool or file manager add rewrite rules (where wap.xxx.com is replaced with your domain, the red part is only added when automatic redirection for mobile access is needed)
windows 2003:
In the host control panel-isapi filters, enable custom url staticization support
Add the following content to the host's others/discuz/httpd.conf file
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:
Create a web.config file in the host's wwwroot directory with the following content
<?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>
