首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >htaccess移动重定向是在PC上重定向。

htaccess移动重定向是在PC上重定向。
EN

Stack Overflow用户
提问于 2012-07-04 00:53:39
回答 1查看 467关注 0票数 0

我的主站点(www.jguffphotography.com)目前被htaccess重定向到(mobile.jguffphotography)。效果很好

我有一个目录分别重定向(www.jguffphotography.com/photopage/)到(Mobe.jguffPhotography.com/photopage)

我有一个htaccess文件在我的主域,并在光刻目录。

所有的工作从我的手机很好,但在个人电脑上的光光网址重定向到移动子域。

我拥有的主要域htaccess编码是

代码语言:javascript
复制
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteRule ^$ http://mobile.jguffphotography.com [L,R=302]

我在光刻目录中找到的是

代码语言:javascript
复制
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RedirectMatch 301 ^/photopage/([^.]+).html$ http://mobile.jguffphotography.com/photopage/$1.html

EN

回答 1

Stack Overflow用户

发布于 2012-07-04 01:00:49

RedirectCond是mod_rewrite的一部分,适用于下面的RewriteRuleRedirectMatch是mod_alias的一部分,与以前的情况没有任何关系。您需要坚持使用mod_rewrite:

代码语言:javascript
复制
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteRule ^photopage/([^.]+).html$ http://mobile.jguffphotography.com/photopage/$1.html [R=301,L]
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11321144

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档