Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 移动重定向不适用于Joomla站点_.htaccess_Joomla_Seo - Fatal编程技术网

.htaccess 移动重定向不适用于Joomla站点

.htaccess 移动重定向不适用于Joomla站点,.htaccess,joomla,seo,.htaccess,Joomla,Seo,我有两个网站,一个是为台式机设计的,另一个是为移动设备设计的。他们都有相同的内容,但移动网站是专为iPhone、黑莓等手机设计的 以下是我想要的: 当用户通过移动设备到达我的站点时,将自动重定向到移动版本。在移动版上,我有一个链接,上面写着查看完整的html,当他们点击该链接时,无论他们使用的是台式机、iphone还是其他什么设备,他们都会被发送到网站的完整版本 使用Litespeed Web服务器 我无法通过HTACCESS使其工作。下面是my.htace的外观: Options -Index

我有两个网站,一个是为台式机设计的,另一个是为移动设备设计的。他们都有相同的内容,但移动网站是专为iPhone、黑莓等手机设计的

以下是我想要的:

当用户通过移动设备到达我的站点时,将自动重定向到移动版本。在移动版上,我有一个链接,上面写着查看完整的html,当他们点击该链接时,无论他们使用的是台式机、iphone还是其他什么设备,他们都会被发送到网站的完整版本

使用Litespeed Web服务器

我无法通过HTACCESS使其工作。下面是my.htace的外观:

Options -Indexes
RewriteEngine On
RewriteBase /


#Added the rule below so that redirecting to the index.php does not operate on the mobile site
RewriteCond %{HTTP_HOST}          !^m\.

RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php


# Check if mobile=1 is set and set cookie 'mobile' equal to 1
RewriteCond %{QUERY_STRING} (^|&)mobile=1(&|$)
RewriteRule ^ - [CO=mobile:1:%{HTTP_HOST},S]

# Check if mobile=0 is set and set cookie 'mobile' equal to 0
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule ^ - [CO=mobile:0:%{HTTP_HOST},S]

# cookie can't be set and read in the same request so check
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule ^ - [S=1]

# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos" [NC,OR]
RewriteCond %{HTTP:Profile}       !^$

# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST}          !^m\.
RewriteCond %{QUERY_STRING} !(^|&)mobile=0(&|$)
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP_COOKIE}        !\mobile=0(;|$)
# Now redirect to the mobile site
RewriteRule ^ http://m.mysite.com [R,L]



########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ 404.html [F,L]
#
我试过了,但没有发送到移动站点

这是一个基于Joomla 1.0的网站,我安装了一个SEO组件sh404sef,不确定这是否会导致问题。sh404sef将url转换为seo友好的url


有什么帮助吗?

将此代码放在JOOMLA站点的INDEX.PHP中。该代码几乎可以检测所有手机。将MOBILE.YOURSITE.COM更改为所需的url

函数mobileRedirecta,b{ “手机”若/安卓(android)若/安卓(android)若+手机(手机)若/手机(若)若/安卓(若)若+手机(若)若+手机(若)若/安安卓(若)若/安卓(若)安安卓(若)手机(若)手机(若)手机(若)手机(若)手机(若)手机(若)iphone(若)手机(若)手机(若)手机(若)方)若若若若若若若)手机(iphone(od)方)方方方方方方,前前前前去去去去去去去前去去去去去去去去去去去去去去去去去去去去去去去去去,前去去去去前去去去去去去去去去前去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去去| wap | windowsce | phone | xda | xiino/i.testa | 6590 | 3gso | 4thp | 50[1-6]“我的1244”7.247 7岁,7.247岁,7.247岁,7.247岁,7.247岁,7.247岁,7.247岁,7.247岁,7.247岁,7.247岁,7.247岁,7.247岁,7.247岁,7.242岁,7.244岁,7岁,7.244岁,7岁,7岁,7岁,7岁,7岁,7岁,7岁,7岁,7岁,7岁,7岁,7岁,岁,非非非非本本本本本本州,其他其他其他其他,非非本州,岁,岁,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州,本州(1245)5岁以上的卡帕尼(capi)卡卡卡瓦尼(cdm)卡卡瓦尼(cdm)卡瓦尼(cdm)卡瓦尼(cdm)卡瓦尼(cdm)卡瓦尼(cdm)卡瓦尼(cdm)卡瓦尼(cdm)卡瓦尼(cdm)卡瓦尼(cdm)卡瓦尼(124)卡瓦尼(124)卡瓦尼(cdm)卡卡瓦尼(cdm)卡瓦尼(cdm)卡瓦尼(cdm)卡瓦尼(124)卡瓦尼(cdm)赛赛尼(124)、赛尼(124)、赛尼(124)、赛尼(124)、赛尼(124)卡瓦尼(cdm)卡卡尼(124)、赛尼(124)、赛尼(124)、赛尼(124)卡尼)卡尼)卡卡尼(cdm)卡尼(124)、赛尼(cdm)卡尼(124)、赛尼(124)、赛尼(124)卡尼)卡尼)| eric | k0 | esl8 | ez[4-7]4 0 0 0 0 0 0 0 0 0 0 4 4 4 4 0 0 0 0 0 0 0 0 0 4 4 4 4 4 0 0 0 0 0 0 0 0 0 0 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0方方方方方货币货币货币货币货币货币货币,货币货币货币货币货币货币货币货币货币货币货币货币,货币,货币货币,货币,货币,货币,货币,货币,货币货币,货币,货币,货币,货币,货币,货币,货币,货币,“t”t/1244.t/1244.t/1244.t/1244.t/1244.t t/1244.t/1244.t/1244.t/1244.t/1244.t/1244.t/1244.t/1244.t/1244.t/1244.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.|leno | xi | lg g | \/k | l | u | 50 | 54 | e \-| e \/| \-[a-w]|lynx(124)lynx(124)lynx(124)lynx(124)lynx(124)lynx(124)lynx(124)lynx(124)lynx(124)lynx(124)lynx(124)lynx(124)lynx(1240)m1-1-1-1-1-卡卡瓦瓦卢卢卢卢卢卢布(12)m-卡卡卡卡卡卡卡卡尼赛赛赛赛非非非非非非非非非非卡卡卡卡卡卡非非非非非非非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非卡非“0-2”0-2[0-2”0-2[2-2]2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2 0 0-2[2-2]2-2 0 0-2 0-2 0 0 0-2-2 0 0 0-2 0 0 0-2 0-2 0 0-2 0 0 0 0-2-2 0 0-2 2 2号5 5 5-5 5 5 5 5号n700号强强强强,1-1-1-1-1号10-10-10-10-10-10-10-10-2号强强强强强强强强强的非非本本本本12400-3-2-2-2-2-2-2-2 0 0 0-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-3非非非非非非非本本本本本本本| c | phil | pire | play | uc | pn-2 | pock | rt | se | prox | psio | pt-g | qa | qc07 | 12 | 21 | 32 | 60|\-(2-7)7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7本币(1244)本币(1244)本币(1244)本币(1244)本币(1244)本币(1244)本币(sp01)本币(1244)本币(124本币)本币(1244)本币(1244)本币(1244)本币(1244)本币(1244)本币)本币(1244)本币(1244)本币)本币(本币)本币(1244)本币)本币(本币)本币(本币)本币(本币)本币)本币(本币)本币(本币)本币(本币)本币(本币)本币(本币)本币(本币)本币(本币)本币(本币)本币(本币)本币(本币)本币(本币)本币(本)本币(本)本币(本币)本币(本币)本币(本币)本币(本)本)本124; tx \-9 | up \.b | g1 | si | utst | v400 | v750 | veri | virg | te | vk40 | 5[0-3]|\-v | vm40 | voda | vx52 | 53 | 60 | 61 | 70 | 80 | 81 | 83 | 85 | w3c | webc | whit | wig | nw wmlb | wonu x700 | xda | 2 | g | yas | Ze{ 窗口位置=b; } }navigator.userAgent | | | navigator.vendor | | | window.opera,'http://MOBILE.YOURSITE.COM';