You need to sign in to do that
Don't have an account?
Relative URL dropping Site prefix
I have a component I use on a VF page in a Site with a prefix--http://mysite.force.com/events. I create a relative link to a VF page that is part of the site like this:
<a href="Event?id={!event.Id}">{!event.Name}</a>
The link the component creates drops the prefix, however, and looks like this: http://mysite.force.com/Event?id=00dhwhegdhewy
What's the best way to preserve the site prefix in this case without hard-coding it into the component?
Thanks,
Steve
You can use {!$Site.Prefix} from Visualforce to get the prefix (returns blank when you're in a site with no prefix.
Or from apex: Site.getPrefix();
All Answers
This happened to me just now also,
http://mysite.force.com/events is treated as a PAGE under http://mysite.force.com/ by the BROWSER.
if you access your site through http://mysite.force.com/events/ you will see that the relative link works, because the BROWSER will treat that url as the folder events/ under http://mysite.force.com so the result would be /events/event?id=asd.
One solution is making sure all your links to /events go to /events/
Also note that if a user write http://mysite.force.com/events in the address bar it will take him to your site but with bugged links, in order to fix this you could in the homepage for that site REDIRECT the user to /events/ IF he used /events. To do this you can use the page headers and check the url. This last bit is a theory i have, havent put into practice.
Gaston.
You can use {!$Site.Prefix} from Visualforce to get the prefix (returns blank when you're in a site with no prefix.
Or from apex: Site.getPrefix();