2013-07-23 45 views
0

我有一個Joomla網站,移動重定向沒有htaccess的

  1. 我正在爲它的移動網站。
  2. 我希望手機網站擁有「完整網站」選項。

When I do this, the redirect kicks in again. So the mobile user clicks full site, and the full sure is loaded, which has the mobile redirect script, then they get sent back to the mobile site

你們能建議我該怎麼辦嗎?
此外,

  • 我的移動網站是手工製作,
  • 它不是Joomla模板

所以我需要它重定向到一個子文件夾,而不是一個新的Joomla模板。我不想使用移動joomla。 我也沒有使用htaccess的經驗 謝謝

+0

使用'get_browser'嗅探用戶代理 –

+0

我已經這樣做了,但是當用戶點擊「完整網站」時,重定向所在的索引會再次被嗅探並重定向回移動網站。 – rooster

+0

發送一個像''inde.php?full_site = 1'的附加參數 –

回答

0

你可以使用PHP來做到這一點。 試試這樣的:

<?php 

$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); 
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android"); 
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS"); 
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry"); 
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); 

if ($iphone || $android || $palmpre || $ipod || $berry == true) { 
    header('Location: http://mobile.site.com/'); 
} 

?> 
+0

那麼Windows Phone,Firefox OS等呢? – Quentin

+0

這不是一個詳盡的列表,如果需要,可以添加strpos($ _ SERVER ['HTTP_USER_AGENT'],'Windows Phone');) – David