2013-04-29 40 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