I want to create website which is for mobile version or desktop version. This is possible to create new subdomain of my domain & launch it for mobile . All request which is come from mobile redirect to mobile version folder.
But i want to create same url for desktop version & mobile version site but the directory are different.
For example:
My domain is www.abc.com
for desktop version for mobile version www.abc.com/m
this is physically folder structure of site. But i want when user type www.abc.com
from mobile its show mobile version website and from desktop for same url.
Please see the top answer for this question: Auto detect mobile browser (via user-agent?) It details how to use the User-Agent header to check if a mobile browser is accessing your site, and redirect to the mobile part of your website, just like you stated.
Alternatively if you're using a CMS like Joomla or Drupal, a quick google search will show you how to plug-in a mobile version.
the simpliest way would detect the user agent, if it is a mobile user agent, you could redirect the user to the mobile website. using php would be
<?php
$browser = get_browser(null, true);
//check the $browser to see if it has mobile platform or desktop
if (mobile) header ('location:www.abc.com/m')
if (desktop) header ('location:www.abc.com')
?>
FYI, see the docs here http://php.net/manual/en/function.get-browser.php