I've both www.example.com and m.example.com pointing to the same directory in Ubuntu and there was in the settings.php with this line:


I want to ask what will happen in this case in Drupal where sites are accessed as www. or the m. versions?

In the hook_custom_theme I'm returing a mobile theme whenever the URL is starting with "m.".

I was getting some wierd mix up of mobile and the desktop versions.

I was not able to find any cid with "http://m." URLs in the cache_page mysql table. After I removed this $base_url now both mobile and the desktop versions seem to be showing fine now and also cache_page table is having rows with cid with "http://m...".

I'm not fully sure this but could $base_url cause this?

1 Answer 1


How is your /sites folder structure? You can create subdomain m.example.com, and implement the mobile version in there.

There are different approaches in implementing the subdomains in drupal. it may be multisite and shared database or multisite with different databases and single code and different databases .

what you are looking for is a shared database but different themes (multiple codes), Here is good discussion about this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.