【发布时间】:2015-02-15 17:53:21
【问题描述】:
我已在 .htaccess 文件中插入代码以进行移动重定向:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:X-WAP-PROFILE} !^$ [OR]
RewriteCond %{HTTP:PROFILE} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(Alcatel|Asus|Android|BlackBerry|Ericsson|Fly|Huawei|i-mate|iPAQ|iPhone|iPod|LG-|LGE-|MDS_|MOT-|Nokia|Palm|Panasonic|Pantech|Philips|Sagem|Samsung|Sharp|SIE-|Symbian|Vodafone|Voxtel|WebOS|Windows\s+CE|ZTE-|Zune).*$ [NC,OR]
RewriteCond %{HTTP_ACCEPT} application/vnd.wap.xhtml\+xml [NC,OR]
RewriteCond %{HTTP_ACCEPT} text/vnd.wap.wml [NC]
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{SERVER_NAME} ^www\.(.*)$
RewriteRule ^(.*) http://m.%1/ [L]
我有一个问题:.htaccess 文件仅适用于索引文件,它不能重定向到我网站的其他文件。
我试图在我的手机中写 www.example.com/file_different_to_index.php 并且网站没有重定向到 m.example.com/file_different_to_index.php
【问题讨论】:
标签: .htaccess redirect user-agent mobile-website