I am using MVC, specifically Codeigniter.
I have a need to create a sub domain on the service I am building. To pass a more "Mobile" friend version of the service to a user. Via m.example.com. Generally I would just add a virtual host, put everything in a folder, and so on and so forth, but since I am using MVC on this project most of the functionality lies in models and libs of which are agnostic to the view or even the controllers as far as the output they have.
So my current train of thought is that it would be a waste of resources to create a whole new folder on the machine that has the same exact stuff as the mvc currently in use has, just for the sake of using it as m.example.com. So I am wondering (cause it works this way currently with index.php) Is there a way to say I assume through htaccess that when traffic through m.example.com comes through, that I use a specific controller path, rather than a folder path? So that way just like its big brother index.php m.php (controller in this example) can handle all the core traffic and just have a bunch of functions that connect to the models, libs, etc..
In a comment I made below to someone, I said:
No, m.php is not in root, it's a controller.. I am trying to route any requests to m.example.com to the m.php controller (m.php is in the controller directory, following suit with the MVC pattern), I can access http://example.com/m/function/param/ following the MVC logic, but I would like to have it so http://m.example.com/function/param/ is equal to that of the mvc logic
Which ultimately means I am trying to come up with a logic either through .htaccess or some other means that http://example.com/m/function/param/ and http://m.example.com/function/param/ are the same exact thing, preferably without making a mirror copy of the entire CI installation and code I've built on to it, and putting it in a directory called m
for example. I emphasize on this cause there seems to be some confusion.
You might want to take a look at this, and just alter it to use the HTTP_HOST instead of the user_agent library shown here