I've been trying to use .htaccess for redirecting mobile users to the mobile version of my site. For two people, it doesn't seem to work.
mobile site: http://m.kracov.org
code inside .htaccess:
I also tried Mobile Detect- I searched around and someone said to put this code into the index file of my site:
And also put the php file at the same location as the index file. But it just displays as text on my site. I'll admit I don't know what I'm doing.
mobile site: http://m.kracov.org
code inside .htaccess:
Code:
ErrorDocument 404 http://kracov.org/404.html
RewriteEngine On
# Check for mime types commonly accepted by mobile devices
RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC] RewriteCond %{REQUEST_URI} /$ RewriteRule ^ http://m.kracov.org%{REQUEST_URI} [R,L]
I also tried Mobile Detect- I searched around and someone said to put this code into the index file of my site:
Code:
<?php
@include("Mobile_Detect.php");
$detect = new Mobile_Detect();
if ($detect->isMobile() && isset($_COOKIE['mobile']))
{
$detect = "false";
}
elseif ($detect->isMobile())
{
header("Location:http://m.kracov.org");
}
?>
And also put the php file at the same location as the index file. But it just displays as text on my site. I'll admit I don't know what I'm doing.