Hi guys,

Currently I have a regular website, utilizing LAMP. I'd like to add a redirect for mobile devices to a subdomain, something like: m.mydomain.com

There's going to be some content differences between the content for PC and mobile devices.
What is the best way to do that? Can it be done with .htaccess file or do I need some sort of PHP script?

Thanks

try with javascript

if( screen.width <= 480 ) {
    location.href = '/m.yourdomain.html';
}

normally screen widths are lessor equal to 480 px for mobile devices.
user agent is another method.

it's work, thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.