9

Sites provides built-in logic that helps you display user-friendly URLs and links to site visitors. For that we need to implement Site.UrlRewriter interface and create our own class to map user-friendly URLs.

When I convert the URL with less than 2 parameters, and when I use test link it correctly converts the VF page link with query params to an User-Friendly URL.

But when I have more than 2 parameters (3 and above), it does not correctly map and renders the link properly. Meaning it will show the VF page link with query params instead of user-friendly URL.

I checked by putting debug logs on my Site.UrlRewriter implementation class, and it gives me the correct user-frienly url. I also checked for any limitation on URLFOR tag on VF page. I also checked for character length limitation on the URL, but I don't find any viable solution for this.

Please advice me, if anybody has experience with this Site.UrlRewriter

5
  • Can you add some examples as it may help diagnose your problem?
    – Jon Hazan
    Nov 23, 2012 at 10:19
  • Below is the standard VF Page query param link (relative path) /EVW_PublicationDetail?pid=123456789012345678&purOptId=123456789012345678&pkgOptId=1 we need to convert it to a user-friendly url as below /catalog/publication/123456789012345678/purchase-option=123456789012345678/package-option=2131654645. For this conversion there is an interceptor interface Site.UrlRewrite where we need to implement. I implemented it. It works well when you have upto 2 parameters. when I have 3 or more parameters the conversion does not work.
    – TonyTuan
    Nov 23, 2012 at 10:55
  • 1
    I implemented the Site.UrlRewriter on my dev org following the documentation. Same thing, the class returns the correct url, but when this is with 2+ parameters, it seems to not get applied by Visualforce. I think you may need to contact Sf support. Nov 27, 2012 at 8:56
  • I see this problem and question is from 2012... Now, 2014, I have the same problem or inconvenience... I think the solution is do some tricky and ugly code and pass only one parameter like a string with all the needed parameters. This is very ugly and uncofortable. Dec 19, 2014 at 13:39
  • i am facing an issue with force.com sites where the parameter value being passed from one page is changed. there are total of three parameters. has anyone faced similar issue.
    – Walker
    Jan 17, 2018 at 13:30

1 Answer 1

6

You are not alone - this is a known issue with using URLFOR and the Site.UrlRewriter interface. Your best bet is to use a workaround (like hardcoding the URLs into your visualforce page).

If you need it for a case, the internal salesforce reference number is W-957534.

1
  • I recently submitted case and referenced issue W-957534 from their system. To my surprise I received information that they are not gonna fix it. I pushed them to at least update the documentation so that others will not waste their time with this approach - we will see if they do it
    – neff
    Jul 25, 2017 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .