redirect mobile clients with mod_rewrite

30. August 2011 at 12:00

If you want redirect mobile clients to an own domain, you can do this about the .htaccess file with the following code:

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP_HOST} !^.mobile\.domain\.de$
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR]
 RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC]
 RewriteCond %{HTTP_USER_AGENT} "!(macintosh|ipad)" [NC]
 RewriteRule ^(.*)$ http://mobile.domain.de/ [L,R=302]
</IfModule>

Iphone / Ipad Emulator – Platformunabhängig – GPL/Kostenlos

24. August 2011 at 14:10

Ein kostenlosen (GPL) Plattformunabhängigen (auf Adobe Air Basis) Ipad Emulator könnt ihr bei Google Code laden unter:

http://code.google.com/p/ibbdemo2/downloads/list

PHP: In PHP den Referer Forwarded Client / IP anzeigen, auch hinter einem Load-Balancer

23. August 2011 at 12:20

geht über die Server-Variable „HTTP_X_FORWARDED_FOR“ wie folgt:

echo $_SERVER["HTTP_X_FORWARDED_FOR"];

Magento: Page Cache anpassen

23. August 2011 at 11:22

Das Caching könnt ihr in Magento wie folgt beeinflussen:

protected function _construct()
{
$this->addData(array(
'cache_lifetime'    => 900,
'cache_tags'        => array(Mage_Catalog_Model_Product::CACHE_TAG),
'cache_key'            => $this->getCacheKey()
));
}
public function getCacheKey()
{
return $this->getRequest()->getRequestUri().$this->getCacheCurrencyCode();
}
//retreive current currency code
public function getCacheCurrencyCode()
{
return Mage::app()->getStore()->getCurrentCurrencyCode();
}

De-Aktivieren könnt ihr das Caching wie folgt:

protected function _construct()
{
$this->addData(array(
'cache_lifetime'    => null,
'cache_tags'        => array(Mage_Catalog_Model_Product::CACHE_TAG)
));
}