.htaccess移动重定向仅主页面

时间:2014-10-10 13:17:19

标签: .htaccess redirect mobile

我需要有一些规则的移动重定向的简短帮助,这是我的规则:

RewriteCond %{HTTP_USER_AGENT} "iphone|ipad|ipod|android|nokia|ios|opera m(ob|in)i|iemobile|symbian|samsung|htc|huawei|sonyericsson|blackberry|motorola|lenovo|lg|mot|alcatel|asus-|googlebot-mobile|psp|dalvik|windows ce|webos" [NC]
RewriteCond %{HTTP_REFERER} !^http:\/\/(www\.)?example.com\/(index.php)?$
RewriteRule ^(/)?$ http://example.com/mobile/ [R]

如何编辑它以便它可以工作:一旦你去 example.com 没有任何页面名称或子文件夹,它将被重定向(如果其中一个移动浏览器)示例。 com / mobile / 但是,一旦用户访问 example.com/some/ example.com/page.php ,他就不会被重定向。< / p>

0 个答案:

没有答案