Defining hook_menu() paths for specific base URLs I have a multi-site; each site has its own database but they all share the same codebase. I would like to know if there is a way to define hook_menu() paths at specific base URLs.

Being it a multisite, I have created a common module used by all the sites. I wanted something like this in hook_menu().

 if (base_url == 'wmc.en') {
   $items['wmc/contact-us'] = array('hook menu stuffs');   
 }
 if (base_url == 'gmc.es') {
   $items['gmc/contact-us'] = array('hook menu stuffs');   
 }


I tried this type of code, but hook_menu() doesn't seem to recognize base_url or $_SERVER['SERVER_NAME']. 

Is it possible to achieve what I am trying to do?
If you want to use base url, you should first declare it as a global variable and then use it as $base_url. You should also note that $base_url will include the url scheme (i.e) http or https.

If you have a development or staging environment setup, your base url will probably differ between dev, stg and prod environments. In most of the cases, the production environment will be SSL enabled. So you may have to consider this as well while writing code.

In my opinion, as you have mentioned, you may use a different module and enable it only for the specific site. Or if you deliberately want it to be in a common module, consider using access arguments and define hook_permissions.