How to embed a URL that links to VF page that works for both Partner and Internal Users?

We recently implemented a Partner Portal, but are having trouble embedding links in our templates to VF pages that work for both our internal users and our partner users.

What we are trying to do:

  1. Link to a VF page called “OpportunityTable”

  2. Be able to embed this link in a template that prepends the proper address whether the logged in user is a Partner or Internal user.

Here is what I’ve tried:


<a href="/apex/c__OpportunityTable"> 

Which generates the following URL:

<a href="" rel="nofollow" target="_blank" title="Link https//buildrealtyforcecom/apex/c__OpportunityTable">https:&#47;&#47;buildrealty&#46;force&#46;com/apex/c__OpportunityTable</a>


Partner User - “Under Construction” message is displayed
Internal User - Works Correctly


<a href="/partners/apex/c__OpportunityTable">

Which generates the following URL:

<a href="" rel="nofollow" target="_blank" title="Link https//buildrealtyforcecom/partners/apex/c__OpportunityTable">https:&#47;&#47;buildrealty&#46;force&#46;com/partners/apex/c__OpportunityTable</a>


Partner User - Works Correctly
Internal User - “URL No Longer Exists” message is displayed

Almost solved…but not quite out of the woods yet.

ATTEMPT #3 (success but with unintended results)

<a href="partners/apex/c__OpportunityTable">

Which generates the following URL:



Partner User - Works Correctly (kinda)*
Interal User - Works Correctly (kinda)*

The problem now is that the above template creates a longer and longer URL each time I click on it. Each time I click on the link it adds another “/apex/partners” into the middle of the URL. It keeps getting longer and longer…

Now I’m more confused than I was when I started!

Two ideas.

  1. If you are willing to override the Tab Action - you can simply pass the url: which will kick off the redirects you set up in Page Assignments and take the user to the correct place.

  2. You could also explore the {{$Site}} global merge varialbe within your URL. I know this will prepend the correct community name, I’m just not sure what it will do in the Internal User context. Look for more information here:

Good Luck.