Friendly URL

WebSphere Portal 6.1 introduced concept of friendly URL, what that does is, let you set a friendly URL at the time of creating page. Friendly URL is different than the url mapping in following aspects

  1. By default the friendly URLs are disabled and you need to enable it

  2. The actual URL that you use for accessing page using friendly URL, is made of all the URL's starting from root. Ex. If you create a page under Home page and assign friendly URL testurl to it then you will have to first assign a friendly url to to Home page say home. Then final url for your page will be /home/testurl. In URL mapping you can directly assign a URL to any child page



These are the steps that i used to create Friendly URL mapping on my portal, First set value of friendly.enabled property to true in ConfigService like this



After enabling this property now when you either create new page or when you go to Manage Properties button of the existing page you will get "Friendly URL name" input like this



Use the manage properties, portlet to assign URL labels to every page from Home to your destination page. In my case page hierarchy is like this Root -> Home -> fun -> Test URL. I did assign name home to Home page and fun to fun page and testurl to Test URL page. Now i can access Test URL page using /home/fun/testurl


Implementation
If you create a URL mapping using URL mapping portlet then it gets stored like this in xmlaccess

<url-mapping-context action="update" domain="rel" label="flashquery" objectid="C_VVILMKG1089N00I2U8SB9F00G2">
<access-control externalized="false" owner="uid=wasadmin,o=defaultwimfilebasedrealm" private="false"/>
<portal-url resourceref="6_VVILMKG10G04D0I2C4HO3V0007" update="set"/>
</url-mapping-context>


If you assign friendly URL to a page then it gets stored as value of com.ibm.portal.friendly.name parameter in the page level metadata

<content-node action="update" active="true" allportletsallowed="true" content-parentref="6_CGAH47L008IC40I4BOR2EO00I3"
create-type="explicit" domain="rel" objectid="6_VVILMKG100GBC0I2F1UTLJ0001" ordinal="1300" type="page">
<supported-markup markup="html" update="set"/>
<localedata locale="en">
<title>Test Page</title>
</localedata>
<parameter name="com.ibm.portal.IgnoreAccessControlInCaches" type="string" update="set"><![CDATA[false]]></parameter>
<parameter name="com.ibm.portal.bookmarkable" type="string" update="set"><![CDATA[Yes]]></parameter>
<parameter name="com.ibm.portal.friendly.name" type="string" update="set"><![CDATA[testurl]]></parameter>
<parameter name="com.ibm.portal.remote-cache-expiry" type="string" update="set"><![CDATA[0]]></parameter>
<parameter name="com.ibm.portal.remote-cache-scope" type="string" update="set"><![CDATA[NON-SHARED]]></parameter>

7 comments:

Anonymous said...

Thanks very much for this. I spent a day pulling my hair out and not seeming to find anything in IBM's InfoCenter before coming across this article that explained it all.

Anonymous said...

When I follow the instructions I get a bad redirect like the following

The page isn't redirecting properly

http://localhost:10040/wps/myportal/Home/FriendlyUrl/!ut/p/c5/04_SB8K8xLLM9MSSzPy8xBz9CP0os_gwc1cDSydDRwP3AD83A0_HYAsvU-dgYwN3E6B8pFm8s7ujh4m5j4GBv1GYgYGRn2lwoEEoUN7TmIDucJB9yCqCTIyAKgINDI1NzY0M3A0g8vjMB8kb4ACOBvp-Hvm5qfoFuREGmQHpigCvd95D/dl3/d3/L2dBISEvZ0FBIS9nQSEh/

Anonymous said...

nice one

Ecommerce developer said...
This comment has been removed by a blog administrator.
Rodney Rear said...

I just had an indefinite redirect problem caused by adding a friendly URL. I found I had to make a friendly URL that was different from the page name. Likely it was interpreting the page name as the friendly URL and going through the loop again.

Anonymous said...

Thanks a lot for your post, it did help me perfectly. Nice solution..

prathiba palanisami said...

Thanks a lot ..!!! A good post.