2

How to set a Visualforce page URL that is different from a file name?

At the moment my VF page URLs are the same as the file names: MyPage.page URL will be /apex/MyPage

How to leave file name as is (for example MyPage.page) but change the URL to different one (for example /apex/YourPage)

3

One simple solution would be to create a new "dummy" visualforce page with a name you wished ("YourPage") that will redirect user to another page.

Redirect using javasript. Disadvantage of this solution is that a seocond page name appears on the browser url.

<apex:page>
    <script>
        window.location.href = '/apex/MyPage';
    </script>
</apex:page>

The second solution with an apex:include:

<apex:page>
    <apex:include pageName="MyPage" />
</apex:page>

Here a name of the first page ("YourPage") is not disappearing from the URL so this is preferred solution.

1

If you're working in the context of Sites, you can utilize the URL Rewriter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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