How can I redirect my website for mobile?

I know I have to create a new website for mobile, but how do I make it so that the mobile automatically redirects to my mobile website.

Your phone will NOT just recognize if there is a mobile version available.

If your website is built correctly, you only need a stylesheet. Then when you are adding the <link /> tag, add the media type as handheld like this media="handheld"

So when the webpage is accessed by a mobile device, the browser will know to load the handheld css file.

The other option is to add some kind of check to see if the browser is on a mobile phone. For example in PHP on an HTC phone

<?php
if($_SERVER['HTTP_USER_AGENT'] == ‘HTC_Pro_T7272 Opera/9.50′) {
header(‘http://domain.com/mobileversion");
exit();
}
else
{
echo ‘Show regular site for PCs.’;
}
?>

Also be sure to check for all Mobile User Agent Strings.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>