On a force.com site, how do I force the URL Rewriter to always display the friendly URL (eg: /profile/johndoe) instead of the VisualForce Page (eg: /Profile?id=xxxx)?

Calling the URLFOR function in the page is sometimes returning the VisualForce url instead of the friendly URL. Is there a way to force the URL to instead be the friendly version displayed to the user in the page and in the URL bar?

Below is an example for when the issue occurs server side after a client action:

  1. Let's assume browsing a friendly url /abc/ with an <apex:form> with an <apex:commandButton> that reRenders the form.
  2. After submitting the form, a controller checks if the values submitted are correct. In this example, the values are incorrect. So the server returns a null PageReference after setting some ApexMessages.
  3. The page URL suddenly changes to the visualforce version /Abc_Display?...

The question then is why is the URL changed?


You must log in to answer this question.

Browse other questions tagged .