php - Redirecting to mobile subdomain in a CI application -


i have web app of create mobile version jquery mobile. existing application built in codeigniter; i'll using same controllers, models can; (especially models since i'll needing same data anyway, might have write new controllers).

i'm bit confused how started. want put mobile version on subdomain (m.myhost.tld), however.. since app @ www.myhost.tld , don't feel copying on folder , maintain two, i'm bit confused.

i know can use user agent library in codeigniter detect mobile browsers , load views accordingly; don't know how working subdomain. need customize app/config/routes.php file here, or can fix .htaccess magic? have next none experience .htaccess though. thing know how remove index.php ci apps, , that's copypasta snippet.

edit: wonder if can use tutorial this one want do? seems doing more or less same thing, dynamic usernames instead of simple 'm.'

edit 2: more information, guess.

say detect mobile browsers using user agent library included codeigniter. want direct these browsers m.myhost.tld. however, content want display on mobile website comes controller called mobile can access through www.myhost.tld/mobile/; question if there way route url like.. example www.myhost.tld/mobile/about m.myhost.tld/about. i'm not sure if possible, teehee. still learning!

i'll grateful advice can give me. lot!

if want share same files in different hosts, must assign document root folder of sites in web server, explanation static files, base understand.

browser -> host:z.y.xxx[ip.ip.ip.ip] -> web server -> read filesystem : document root + browser request path

so if document root is:

/hosting/http/z.y.xxx/htdocs 

and request /path-to-static/index.html server try read:

/hosting/http/z.y.xxx/htdocs/path-to-static/index.html 

in conclution, create new host m.mysite.tld in web server , change document root same of www.mysite.tld use directives of host alias, apache serveralias directive. have lot of documentation how configure web server.

you handle host name in php $_server['http_host'] variable.

if specify more, more.

have nice day


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -