2013-04-29 2 views
0

У меня есть 2 версии на сайте, письменный стол и мобильный:Joomla Htaccess мобильный редирект

  1. www.olivashot.com
  2. www.mobile.olivashot.com

Мои htacces перенаправляет мобильные устройства для мобильной версии.

проблема ...

1- Если посетитель приходит от Google обусловленно он искал «вещь» и полную ссылку подмигнула показано, как «www.olivashot.com/index. php/thing ", он перенаправляется на" www.mobile.olivashot.com/index.php/thing " (у меня есть счастливый посетитель)

2- Но если ссылка в google:« www.olivashot.com/вещь ">>> он перенаправлен на" www.mobile.olivashot.com " (Я теряю посетителя, я не показываю, что он ожидал)

я, что это Beause I'm переписывания «что-то», чтобы выйти по умолчанию «index.php» в JOOMLA сайте

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

Работает !!! Спасибо!!! –

Смежные вопросы