日期:2014-05-16  浏览次数:20936 次

apache实现手机访问www网站自动跳转到WAP站点
apache实现手机访问www网站自动跳转到WAP站点

vi /usr/local/apache2/conf/httpd.conf

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Via}i\"" combinedwap
CustomLog "logs/access_log" combinedwap

RewriteLogLevel 9
RewriteEngine On
RewriteLog "/usr/local/apache2/logs/rewrite_wap.log"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
       RewriteEngine On
       RewriteCond %{HTTP:Via} ^.*WAP.*
       RewriteRule   ^(.+)  http://m.abc.com
</Directory>


通过运营商提供的Via信息实现跳转,但是对智能机效果不是很好,因为智能机很多是支持www浏览器的。