2013-04-29 64 views
0

我有2个版本,一个网站,办公桌和移动的:的Joomla htaccess的移动重定向

  1. www.olivashot.com
  2. ​​

我htacces被重定向移动设备的移动版本。

问题 ...

1-如果他东阳一直在寻求“东西”和全链路it's显示为“www.olivashot.com/index访问者来自谷歌。 PHP /东西“它重定向到”www.mobile.olivashot.com/index.php/thing“ (我有一个快乐的访问者)

2-但如果谷歌链接是:”www.olivashot.com /东西“>>>他被重定向到”www.mobile.olivashot.com“ (我失去了一位访问者,因为我没有显示他的预期)

我的东西,这是beause I'm重写“东西”退出在Joomla网站默认的“的index.php”

RewriteBase/

## Begin - Joomla! core SEF Section. 
# 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
# 
# If the requested path and file is not /index.php and the request 
# has not already been internally rewritten to the index.php script 

RewriteCond %{REQUEST_URI} !^/index\.php 
# and the request is for something within the component folder, 
# or for the site root, or for an extensionless URL, or the 
# requested URL ends with one of the listed extensions 
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC] 
# and the requested path and file doesn't directly match a physical file 
RewriteCond %{REQUEST_FILENAME} !-f 
# and the requested path and file doesn't directly match a physical folder 
RewriteCond %{REQUEST_FILENAME} !-d 
# internally rewrite the request to the index.php script 
RewriteRule .* index.php [L] 
# 
## End - Joomla! core SEF Section. 




RewriteEngine On 
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] 
RewriteRule ^(.*)$ http://www.mobile.olivashot.com/$1/ [R=301,L] 

回答

2

你应该把最后一块前的Joomla定制重定向具有一定出口点。这意味着顺序应该是:

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC] 
RewriteRule ^(.*)$ http://www.mobile.olivashot.com/$1/ [R=301,L] 


## Begin - Joomla! core SEF Section. 
... 

可以删除行RewriteEngine叙述在它在文件的顶部已启用。 为了增加安全性,一旦你得到这个工作,你可以看看样板模板的.htaccess文件,h5bp.com

+0

工程!谢谢!!! – 2013-04-30 10:01:56