This is a "why" question -- Hoping William van Weelden is watching since he has lots of related topics online ---
For quite some time, our developers have used this construct, where helpID is actually the string we plug into the Context Sensitive map GUI...not the Map ID number, the actual string. This has always worked well.
"/help/A/a_rhc.htm#" + helpID;
I did something unusual recently (at least I think so) with a result that I can't explain. I created a separate webhelp project, and hid the output in a subdirectory of primary, so it looks like this:
/help/index.htm <primary content, with A/B generated as part of standard webhelp>
help/foo/index.htm <sneaky folder copied in manually so contents are not searched within parent but are within this folder>
Inexplicably, although I built the sneaky project the same way (other than not using content category tags to create subdirs), I have to use index_csh.htm to get the mapIDs to redirect. I don't really comprehend why, if it works ok for the main help project and all the little cshdats etc are created, the old school _rch doesn't work. This is not critical but I'd like to understand in case there is a side effect I've not yet discovered. For that new sneaky folder, I have to use calls like this:
"/help/foo/foo_csh.htm#" + helpID;
The same type of ID (map ID string, not number) are used, so I don't grok the reason.
A good start is see which version of RH you are using. I have looked into RH7 and later and as far as I remember, it doesn't work as you describe. (See also http://www.wvanweelden.eu/articles/part/rhc-start-file)
If you call the rhc file with an id after the # (rhc.htm#123), the number refers to a topic id that is generated on compile time. This is completely separate from any id you have set in RoboHelp. At least, that is how the scripts say it works iin the versions I have studied.
The RHC file does not support these strings at all, but the CSH file does. The _csh file does support this, but there is a catch: if you are using the map ID string AND that consists of numbers, the method you use will treat is as the map number. The safe way is to call the file as follows: foo_csh.htm#topicid="+ helpID;
If you want to understand how the system works, please see the link above. I have tried to gather all information on the WebHelp CSH I could reverse engineer from the code.