AMH 社区首页
AMH社区 - 开放自由有价值的社区
[求助帖] 移动适配301配置,不知道哪里不对不成功啊 |
|
---|---|
crc5201314 |
crc5201314 发表于 2017-09-02 15:51:18
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^$ http://m.meizancheng.com/ [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/$ http://m.meizancheng.com/$1/$2/ [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)_([0-9]+).html$ http://m.meizancheng.com/$1/$2/$3_$4.html [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([0-9]+).html$ http://m.meizancheng.com/$1/$2/$3.html [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+).html$ http://m.meizancheng.com/$1.html [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/$ http://m.meizancheng.com/$1/ [R=301,L] 这个是我复制我另一个网站的,为什么在AMRewrite使用就不成功,同样是apache啊
点赞,加油! (0分)
2017-09-02 15:51:18 1
|
894587758 |
把amh.conf设置成默认的 然后选择试一下
回复
2017-09-03 13:00:03 2
|
crc5201314 |
我是复制我另一台linux服务器,也是apache的网站移动适配规则 上面的移动适配规则在那个服务器网站是可以根据相应的设备做301跳转的 只是在AMRewrite使用就不生效 是复制根目录下的.htaccess规则
回复
2017-09-03 18:07:31 3
|
kint7669 |
引用: 复制 .htaccess 文件到你的跟目录,而不是 AMRewrite 里面。 AMRewrite 是nginx 用的。
回复
2017-09-03 20:57:22 4
|
lovem |
阿帕奇你应该用.htaccess
回复
2017-09-05 17:42:25 5
|
yeiden |
移动适配可以写js啊,为什么要301,pc站放弃了?
回复
2017-09-09 12:10:33 6
|
crc5201314 |
谢谢了,不知道linux的该怎么写
回复
2017-09-11 16:04:20 7
|
crc5201314 |
回复
2017-09-11 16:05:03 8
|
crc5201314 |
我又修改下,好像又行了
但是之前的明明也可以了,但在这个服务器却会出现死循环 代码如下 RewriteCond %{HTTP_HOST} ^qicheng0797.com [NC] RewriteRule ^(.*)index\.html$ http://qicheng0797.com/$1 [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^$ http://www.qicheng0797.com/$1 [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/$ http://www.qicheng0797.com/$1/$2/ [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/$ http://www.qicheng0797.com/$1/$2/$3/ [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/$ http://www.qicheng0797.com/$1/$2/$3/$4/ [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([0-9]+).html$ http://www.qicheng0797.com/$1/$2/$3.html [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/([0-9]+).html$ http://www.qicheng0797.com/$1/$2/$3/$4.html [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/([0-9]+).html$ http://www.qicheng0797.com/$1/$2/$3/$4/$5.html [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)_([0-9]+).html$ http://www.qicheng0797.com/$1/$2/$3_$4.html [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)_([0-9]+).html$ http://www.qicheng0797.com/$1/$2/$3/$4_$5.html [R=301,L] RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap" [NC] RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)_([0-9]+).html$ http://www.qicheng0797.com/$1/$2/$3/$4/$5_$6.html [R=301,L] 备注:不带www的是PC站,带www的是手机站 还有要说明一下,我的是用织梦做的 列表命名规则为:{typedir}/{aid}.html (举例http://qicheng0797.com/html/changjia/) 文章命名规则为:{typedir}/list_{page}.html (举例http://qicheng0797.com/html/huoyuan/1.html) 以上是对index.html做301跳转到 栏目页、栏目页分页、文章页根据相应设备做301跳转移动站(也就是根据UA做跳转)
回复
2017-09-12 14:46:34 9
|