function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Issue with URL rewrite when having 2 or more parameters

I'm facing an issue with my site where URL rewrite is not working using URLFOR() for 2 or more parameters. As per an answer on Stack Overflow this is an existing issue. (

Has anyone faced a similar issue before and how was it resolved?? Please let me know ASAP as I need this urgently.
Just to close the loop on this,  the answer from Stackexchange by Ryan Guest says

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.
Daniel MoralesDaniel Morales

Same problem here, I see that the StackExchange question ( is too old, from 2012. So there is no solution from Salesforce. Also, when we catch several parameters in URLFOR, the Site URL Rewriter capture the map of parameters of the pagereference adding 'amp;' to the parameter name except the last one. For example, if I have this:

In generateUrlFor(), the params captured with pagereference.getParameters() are like this:

amp;param1=value1, amp;param2=value2, param3=value3

Is this a bug? problem with code type? We don't know...

We manage to solve the problem by the ugly and chunky way. Grouping all the parameters in the URLFOR in only one with some format and read it in generateUrlFor() method. For example: params='param1:value1/param2:value2/param3:value3'. Really ugly and string work in the method.

Also you can Javascript the links, generating the hrefs in 'onClick' event with a remote action and launching the friendly url via window.location.href for example.

Anyway, ugly solutions for a bug.