typical a user trail
step 1.
http://www.site.com (we check whether browser is mobile or not, if mobile, php makes the redirect -> step 2)
step 2.
http://www.site.com/m/ (.htaccess is here. we generate a unique_id for this user and redirects -> step 3)
step 3.
http://www.site.com/m/SN67Hgde54kd83jhdk3/ (this is final destination and we are still under "m". And index.php is called here by htaccess, but not display in the URL)
dir "m" is for mobile has index.php and .htaccess files only.
SN67Hgde54kd83jhdk3 is unique_id and this directory does not exist, but I will capture this from index.php
Also, you said unique id will be RE-generated, true, but I don't care..bcos I captured one at the beginning and will use that in the url throughout the visit for that user. Now, how I will utilize this id is that I will store it in a flat file or DB. I will use this as a lookup table. Then I will create my own session file and vars. I will store them into the flat file or DB corresponding to that unique id in the URL. Remember, this unique id stay in the url during visits. So, I am able to identify that user from that URL. Otherwise, as I explained previously, DoCoMo mobile carrier is really overriding all proxy server headers, therefore my server is not able to create stable session id. This is a known issue by any developer in Japan. Everyone has his own solution. I think my solutions will work if I can fix the .htaccess redirect issue.