Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Does anyone know the rules by which subdomain prefixes are added to org servers.

Both for standard org names (e.g. cs11.visual.force.com, c.cs11.visual.force.com, manpkg.cs11.visual.force.com) and site org names(wakka-wakka.force.com, dev-wakka-wakka.force.com)

Is there any way of forcing a single domain for access without any mangling? Are there any good rules for coding to account for the apparent random mangling / redirection that can occur?

share|improve this question

1 Answer 1

The naming rules are consistent, but you shouldn't concern yourself with the rules. There's only three things you should know for most usual cases.

Most of the sub domains focus on either browser pipelining, such as separating content from code, or isolating modules, increasing security by using the browser's CORS (Cross Origin Resource Sharing).

Rule 1: Url.getSalesforceBaseUrl().toExternalForm() will always give you the current host name. Use this if you need to link back to wherever you are in the current context.

Rule 2: Use Page.pageName to reference a Visualforce page in Apex Code. The system will automagically get you where you intended to go. Also see StandardController and related classes for links to standard pages.

Rule 3: Use URLFOR in Visualforce syntax to automagically link to the right host name. You can link pretty much anywhere with URLFOR, including pages like Log a Call or edit pages.

Bonus: The system is pretty smart, and can usually figure out which host name you should be on, so don't try to outsmart the system unless it really is not working as expected based on the above rules.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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