0

I have a XPage which is passing information to another XPage in the form of a URL parameter (this is important due to SEO). I am able to use: java.net.URLEncoder.encode to encode the URL and then I can have ampersand in my parameter value and I am able to use just param.get() to get the values without decoding them. This works fine, but when I combine this with server side substitution it doesn't work as expected, it reverts the ampersand back to a normal ampersand rather than %26. Any ideas would be really appreciated here? Server side substitution is important due to SEO as well.

Update:

This is the URL before the submission as displayed in the address-bar (if we assume my category is Fruit & Vegetables):

/product-byCategory/Fruit+%26+Vegetables

The server side substitution rule is:

- /product-byCategory/*
- /mywebsite.nsf/xspProductByCat.xsp?cat=*

The query string value is:

cat=Fruit+&+Vegetables

What's interesting is that if I type this URL in the address-bar, I get the correct query string:

http://www.mywebsite.com/mywebsite.nsf/xspProductByCat.xsp?cat=Fruit+%26+Vegetables
pipalia
  • 911
  • 1
  • 12
  • 46

1 Answers1

0

I faced the same problem, but I searched (and found) a different solution. I don't need substitution, I don't use a QueryString, and Google apparently doesn't mind.

I use this type of URL:

http://www.mywebsite.com/mywebsite.nsf/xspProductByCat.xsp/Fruit+%26+Vegetable

Instead of the QueryString, I get the extended information through

    var name= facesContext.getExternalContext().getRequestPathInfo();

The pages of a website that was created this way are correctly indexed by Google and Bing. We're not entirely satisfied about the page ranks but that's a different topic.

Here are the website and a example of an extended URL

D.Bugger
  • 2,300
  • 15
  • 19
  • Many thanks D.Bugger - that's a very interesting solution. For the time being for this one specific problem we converted "Fruit & Vegetables" to "Fruit and Vegetables" in the URL and then when it's displayed, I used @Replacesubstring to replace and with & and the customer is happy with that solution for now. – pipalia Oct 29 '12 at 11:06
  • I really like your solution, but the customer wants the URL to look natural rather than have the notes db path. Just tried & and that doesn't work either. I am happy with this solution where I replace " and " with " & " in the UI (I look for " and " including spaces in order to make sure part of the word is not replaced). – pipalia Oct 30 '12 at 17:50
  • I might try combining your solution with server side substitution - I presume the values can be anything if we are using a "/" as a separator as per your suggestion. – pipalia Nov 02 '12 at 10:41