SlideShare a Scribd company logo
Enable SEO URL in
WebSphere Portal
Michele Buccarello
2/4/2015
This document describe a way to implement friendly SEO URL in WebSphere Portal
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 1
Table of Contents
Abstract ............................................................................................................................................................. 2
REMOVING THE RICH STATE FROM PORTAL AND WCM CONTENT .................................................................. 2
Configuring portal for friendly url ................................................................................................................. 3
Enable base url in theme............................................................................................................................... 5
Edit the navigation jsp................................................................................................................................... 6
Create a java filter for WCM url .................................................................................................................... 7
Conclusion about rich state........................................................................................................................... 9
Remove the context url /wps/portal............................................................................................................... 10
Create an apache reverse proxy.................................................................................................................. 10
Enable modules ........................................................................................................................................... 10
Configure Apache as reverse proxy............................................................................................................. 10
How it works................................................................................................................................................ 11
Routing rules............................................................................................................................................ 11
Payload management.............................................................................................................................. 12
Rewrite rule explanation ......................................................................................................................... 12
Proxy Pass and mod_substitute .............................................................................................................. 13
CONCLUSION ................................................................................................................................................... 13
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 2
Abstract
In WebSphere Portal the concept around the URL are complex because are not simply URL but are RICH
URL. Portal URL are structured in this way:
Rich state is an xml that contain the portal state, this xml is gzipped and enconded with a modified base64
codec, the only way to decode the state in xml format is use the portal poc ( piece of content ) servlet. In
this presentation http://www.socialbizug.org/files/app#/file/443ae822-48ad-40d1-b106-8750f0e79447 you
could find all information about all concept around the WebSphere Portal URL, is important read this pdf to
understand what you lose if a customer want full friendly SEO url and not partial like normal Portal url.
What we do in this article?
We want display Portal url without context and rich state, in other words :
- From /wps/portal/home/shop/shoes/!ut/p/104_05dsffds90..
- To /home/shop/shoes
What are the assumption we need to archive this goal?
1) Portal Page doesn’t have portlets that made a post to the same page or other page.
2) Portlet wiring attach rich state, don’t use it!
3) WCM url are cleaned with a WCM url filter, without it all WCM url have rich state.
REMOVING THE RICH STATE FROM PORTAL AND WCM CONTENT
In this step we configure portal to remove the rich state from Portal and WCM content. The basics of this
operations are described in this wikis document:
- http://www-01.ibm.com/support/knowledgecenter/SSHRKX_8.5.0/mp/admin-
system/mp_friendly_short_url.dita?lang=en
- http://www-
10.lotus.com/ldd/portalwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Web+Content+Manager+8+P
roduct+Documentation#action=openDocument&res_title=Example_2_Generate_a_friendly_URL_f
or_web_content_wcm8&content=pdcontent
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 3
- http://www-
10.lotus.com/ldd/portalwiki.nsf/dx/Implementing_a_clean_URL_in_IBM_WebSphere_Portal_8-
based_WCM_rendering
Configuring portal for friendly url
In the administrative console under resource environment provider click on WP ConfigService
Click on custom properties
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 4
Click on button new…
Add the property into the was
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 5
Click save
Enable base url in theme
In the Portal theme definition add the property
<parameter name="com.ibm.portal.theme.hasBaseURL" type="string" update="set">true</parameter>
add in the xmlaccess register script this parameter
If you’re theme is already registered retrieve the unique name and run the xml access below
<?xml version="1.0" encoding="UTF-8"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="PortalConfig_8.5.0.xsd" type="update">
<portal action="locate">
<theme action="update" uniquename="com.ibm.portal.custom.theme.theme85" >
<parameter name="com.ibm.portal.theme.hasBaseURL" type="string" update="set">true</parameter>
</theme>
</portal>
</request>
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 6
Edit the navigation jsp
In the navigation.jsp add keepNavigationalState="false" in the portal navigation tags, this particular
property remove the rich state from the portal navigation URL.
Search this string:
- <a href="?uri=nm:oid:${nodeID}"
Replace with this:
- <portal-navigation:urlGeneration contentNode="${nodeID}" keepNavigationalState="false"
allowRelativeURL="true">
<a href="<%wpsURL.write(out);%>"
See the image below.
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 7
After the replaced string search the first “</a>” and replace it with </a></portal-navigation:urlGeneration>,
see the image below.
Create a java filter for WCM url
Create new dynamic project with the same projectname and ear name like the image below.
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 8
In src package create a package named:
- com.ibm.workplace.wcm.api.rewrite
create into it two java class:
- FriendlyUrlGenerationFilter.java
- FriendlyUrlGenerationFilterFactory.java
The functional sample content is located in this links:
- http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Example_2_Filter_class_wcm8
- http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Example_2_Filter_factory_class_wcm8
Under the webcontent WEB-INF create the plugin.xml and write the information below:
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="com.ibm.workplace.wcm.api.rewrite.plugin" name="URL generation filter"
version="1.0.0" provider-name="IBM">
<extension
point="com.ibm.workplace.wcm.api.ContentUrlGenerationFilter"
id="UrlGenerationFilter">
<factory
class="com.ibm.workplace.wcm.api.rewrite.FriendlyUrlGenerationFilterFactory"
weight="4"/>
</extension>
</plugin>
The structure must be like the image below.
At this point you could install the ear in portal and set the startup behavior to a number upper than WCM
ear startup number (normally 21 is a right number). We need to do this change to ensure the connections
between WCM and the filter extension point.
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 9
Conclusion about rich state
With this four step after e Portal restart we successful remove the rich state from all page that use the
theme with the customized navigation jsp and from all WCM contents.
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 10
Remove the context url /wps/portal
Websphere Portal for security reason have two area, one for anonymous users and one for authenticated
users:
- /wps/portal anonymous
- /wps/myportal authenticated
We remove the context root only for anonymous user to prevent security related problems.
Create an apache reverse proxy
To create an apache reverse proxy we a lot of way, personally I prefer opensuse because have a built in
apache with a structured folders, in this guide http://en.opensuse.org/SDB:Apache_installation you could
find all information about apache installation. After a successful installation we need to create a virtualhost
as documented in the guide.
Enable modules
Apache 2.2 has a lot of built-in modules, opensuse by default don’t enable it when you do the first
installation, to enable it you need to edit the file /etc/sysconfig/apache2 , inside it there is a variabile
called APACHE_MODULES append to the end of this variabile this modules:
- rewrite http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
- proxy http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
- proxy_http http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html
- substitute http://httpd.apache.org/docs/2.2/mod/mod_substitute.html
This modules are required to configure apache to act as a reverse proxy and manipulate http requests and
payload. In the apache foundation site you could find all information for every modules.
Configure Apache as reverse proxy
Below the piece of configuration you need to configure routing and payload manipulation to the
WebSphere Portal Installation request and response.
# used for mantain old link in external forum and site and with a 301 redirect
RewriteRule ^/holidays/old-link?$ /holidays/new-link [L,R=301]
# this rewrite rule with proxy transparent use a regulare expresion to manage all context root different
to the main route /wps/portal
# the /wps escape all route to the servlets poc mypoc contenthandler mycontenthandler and all portlets
# customThemeStatic and customThemeDynamic are the context root to my custom theme
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 11
RewriteCond %{REQUEST_URI} !/(wps/|customThemeStatic/|customThemeDynamic/)
RewriteRule ^(.*)$ /wps/portal$1 [L,PT]
#this rewrite masquerade the landing page and remove the path to it
RewriteCond %{HTTP_HOST} ^www.example.it
RewriteCond %{REQUEST_URI} ^(/)?$
RewriteRule ^(/)?$ /wps/portal/home [PT,NC]
ProxyPass / http://www.example.it/
<Location / >
ProxyPassReverse http://www.example.it/
#this output filter simly parse the HTTP payload and remove /wps/portal from it, finally add /wps/portal
only to the html tag base url
#this is required to the portal javascript framework
AddOutputFilterByType SUBSTITUTE text/html
# remove /wps/portal from the payload
Substitute "s|/wps/portal||nfq"
# add to the base url tag /wps/portal to prevent issue with the portal javascript framework
Substitute "s|www.example.it|www.example.it/wps/portal|nfq"
</Location>
How it works
In this area we explain how the solution it works.
Routing rules
To archive this result we divide all uri in two groups:
- All uri different from “/wps/portal”
- All uri that match “/wps/portal”
In the first group there are:
- all common servlet like poc (/wps/poc) , mypoc (/wps/mypoc) , contenthandler
(/wps/contenthandler), mycontenthandler (/wps/mycontenthandler)
- all authenticated portal uri (/wps/mycontenthandler)
- all portlets (/wps/PA_* )
- all predeployed portlet (/custom_context_root)
- all filters, OSGI plugin and so on (/custom_context_root)
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 12
In the second group we identify all uri that must be routed to /wps/portal. To identify this uri we must use
a negative approach because with the mod_substitute we remove /wps/portal from the payload.
With these assumptions we made all rewrite rule to setup the right routing.
Payload management
There are two possibile way to manage the payload:
- Application server side with a servlet filter
- HTTP Server side with HTTP Filter module
We choose the second way because:
- From apache 2.2 we have a built solution that provide an in memory payload rewrite with the
mod_substitute.
- Performance scalability, it is quite simple to install more HTTP server than install more WebSphere
Portal installation.
- A servlet filter interact with all HTTP request and response, portal have a set of built-in servlet
filter, this means you must understand how to manage the servlet filter chain.
- With a simple regular expression we could manage all routing request directly from the HTTP
Server.
Rewrite rule explanation
This rewrite url match with a negative condition all http request that must be routed to /wps/portal
RewriteCond %{REQUEST_URI} !/(wps/|customThemeStatic/|customThemeDynamic/)
RewriteRule ^(.*)$ /wps/portal$1 [L,PT]
This rewrite rule masquerade the homepage url
RewriteCond %{HTTP_HOST} ^www.example.it
RewriteCond %{REQUEST_URI} ^(/)?$
RewriteRule ^(/)?$ /wps/portal/home [PT,NC]
Enable SEO URL in WebSphere Portal
Websphere Portal SEO Friendly URL
Author:Michele Buccarello Page 13
Proxy Pass and mod_substitute
All HTTP request skipped in the first rewrite rule are routed with the proxy pass directive
ProxyPass / http://www.example.it/
All response are manage inside the <location /> tag, inside this you could see the substitute that rewrite
the payload.
<Location / >
ProxyPassReverse http://www.example.it/
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|/wps/portal||nfq"
Substitute "s|www.example.it|www.example.it/wps/portal|nfq"
</Location>
CONCLUSION
In this article you have a way and set of rules to implement SEO url in portal, but remember what we say in
the abstract, the /wps/portal don’t affect the SEO ranking of the site.

More Related Content

What's hot (20)

PPTX
Cloudera - The Modern Platform for Analytics
Cloudera, Inc.
 
PDF
How Graph Technology is Changing AI
Databricks
 
PPTX
Mapping Data Flows Training April 2021
Mark Kromer
 
PDF
Amazon S3 Overview
Emilio Trussardi
 
PDF
AWS reInvent 2022 reCap AI/ML and Data
Chris Fregly
 
PDF
Debunking some “RDF vs. Property Graph” Alternative Facts
Neo4j
 
PDF
The Heart of the Data Mesh Beats in Real-Time with Apache Kafka
Kai Wähner
 
PDF
Building an open data platform with apache iceberg
Alluxio, Inc.
 
PPTX
Snowflake Datawarehouse Architecturing
Ishan Bhawantha Hewanayake
 
PDF
Pipelines and Data Flows: Introduction to Data Integration in Azure Synapse A...
Cathrine Wilhelmsen
 
PPTX
Hive, Presto, and Spark on TPC-DS benchmark
Dongwon Kim
 
PDF
More on "More Like This" Recommendations in SOLR
Oana Brezai
 
PDF
The three layers of a knowledge graph and what it means for authoring, storag...
Neo4j
 
PDF
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Kai Wähner
 
PPTX
Elastic Data Warehousing
Snowflake Computing
 
PDF
Azure Data Factory presentation with links
Chris Testa-O'Neill
 
PDF
Azure Data Factory v2
inovex GmbH
 
PPTX
How to migrate workloads to the google cloud platform
actualtechmedia
 
PPTX
1- Introduction of Azure data factory.pptx
BRIJESH KUMAR
 
PPTX
Data Lakehouse, Data Mesh, and Data Fabric (r1)
James Serra
 
Cloudera - The Modern Platform for Analytics
Cloudera, Inc.
 
How Graph Technology is Changing AI
Databricks
 
Mapping Data Flows Training April 2021
Mark Kromer
 
Amazon S3 Overview
Emilio Trussardi
 
AWS reInvent 2022 reCap AI/ML and Data
Chris Fregly
 
Debunking some “RDF vs. Property Graph” Alternative Facts
Neo4j
 
The Heart of the Data Mesh Beats in Real-Time with Apache Kafka
Kai Wähner
 
Building an open data platform with apache iceberg
Alluxio, Inc.
 
Snowflake Datawarehouse Architecturing
Ishan Bhawantha Hewanayake
 
Pipelines and Data Flows: Introduction to Data Integration in Azure Synapse A...
Cathrine Wilhelmsen
 
Hive, Presto, and Spark on TPC-DS benchmark
Dongwon Kim
 
More on "More Like This" Recommendations in SOLR
Oana Brezai
 
The three layers of a knowledge graph and what it means for authoring, storag...
Neo4j
 
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Kai Wähner
 
Elastic Data Warehousing
Snowflake Computing
 
Azure Data Factory presentation with links
Chris Testa-O'Neill
 
Azure Data Factory v2
inovex GmbH
 
How to migrate workloads to the google cloud platform
actualtechmedia
 
1- Introduction of Azure data factory.pptx
BRIJESH KUMAR
 
Data Lakehouse, Data Mesh, and Data Fabric (r1)
James Serra
 

Viewers also liked (7)

PDF
Search engine optimization (seo)
கணேஷ் பழனிசாமி
 
PDF
Custom theme creation websphere portal 8.5
michele buccarello
 
PDF
Websphere portal theme menu framework
michele buccarello
 
PDF
Custom theme creation for Websphere Portal 8
michele buccarello
 
PDF
IBM Connections mail with exchange backend
michele buccarello
 
PDF
IBM Connections 4.5 bidirectional synchronization
michele buccarello
 
PDF
IBM Connections 4.5 User Data Propagation.
michele buccarello
 
Search engine optimization (seo)
கணேஷ் பழனிசாமி
 
Custom theme creation websphere portal 8.5
michele buccarello
 
Websphere portal theme menu framework
michele buccarello
 
Custom theme creation for Websphere Portal 8
michele buccarello
 
IBM Connections mail with exchange backend
michele buccarello
 
IBM Connections 4.5 bidirectional synchronization
michele buccarello
 
IBM Connections 4.5 User Data Propagation.
michele buccarello
 
Ad

Similar to Enable seo friendly url in websphere portal (20)

PDF
Portal application development using Websphere Portlet Factory
Dacartec Servicios Informáticos
 
PDF
IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.
Dacartec Servicios Informáticos
 
PDF
Style guide for share point 2013 branding
Vinod Dangudubiyyapu
 
PDF
This+is+a+new+set+of+training+materials
Craig Hannon
 
PDF
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 
PPTX
How to Add Pagination in Website portal in Odoo
Celine George
 
PPTX
WordPress 3.0 at DC PHP
andrewnacin
 
PDF
An introduction to weblogic console
bispsolutions
 
DOCX
Website analysis report
vimlesh88
 
PPT
Deploy Rails Application by Capistrano
Tasawr Interactive
 
PPTX
A High-Performance Solution To Microservices UI Composition
Alexey Gravanov
 
PDF
Banquet 42
Koubei UED
 
PDF
夜宴42期《Gadgets》
Koubei Banquet
 
PPTX
Hardcode SEO
Michel Ozzello
 
PDF
Toms introtospring mvc
Guo Albert
 
PDF
.NET Foundation website suggestions for improvement
Lee Englestone
 
PDF
Web components - An Introduction
cherukumilli2
 
PPTX
WordPress Optimization & Security - LAC 2013, London
Bastian Grimm
 
PPT
WordPress Security - WordCamp NYC 2009
Brad Williams
 
PPT
EPiServer Web Parts
EPiServer Meetup Oslo
 
Portal application development using Websphere Portlet Factory
Dacartec Servicios Informáticos
 
IBM WebSphere Portal Integrator for SAP - Escenario de ejemplo.
Dacartec Servicios Informáticos
 
Style guide for share point 2013 branding
Vinod Dangudubiyyapu
 
This+is+a+new+set+of+training+materials
Craig Hannon
 
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 
How to Add Pagination in Website portal in Odoo
Celine George
 
WordPress 3.0 at DC PHP
andrewnacin
 
An introduction to weblogic console
bispsolutions
 
Website analysis report
vimlesh88
 
Deploy Rails Application by Capistrano
Tasawr Interactive
 
A High-Performance Solution To Microservices UI Composition
Alexey Gravanov
 
Banquet 42
Koubei UED
 
夜宴42期《Gadgets》
Koubei Banquet
 
Hardcode SEO
Michel Ozzello
 
Toms introtospring mvc
Guo Albert
 
.NET Foundation website suggestions for improvement
Lee Englestone
 
Web components - An Introduction
cherukumilli2
 
WordPress Optimization & Security - LAC 2013, London
Bastian Grimm
 
WordPress Security - WordCamp NYC 2009
Brad Williams
 
EPiServer Web Parts
EPiServer Meetup Oslo
 
Ad

Recently uploaded (20)

DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PPTX
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PDF
monopile foundation seminar topic for civil engineering students
Ahina5
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PPTX
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
PPTX
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
monopile foundation seminar topic for civil engineering students
Ahina5
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Hashing Introduction , hash functions and techniques
sailajam21
 
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
Day2 B2 Best.pptx
helenjenefa1
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 

Enable seo friendly url in websphere portal

  • 1. Enable SEO URL in WebSphere Portal Michele Buccarello 2/4/2015 This document describe a way to implement friendly SEO URL in WebSphere Portal
  • 2. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 1 Table of Contents Abstract ............................................................................................................................................................. 2 REMOVING THE RICH STATE FROM PORTAL AND WCM CONTENT .................................................................. 2 Configuring portal for friendly url ................................................................................................................. 3 Enable base url in theme............................................................................................................................... 5 Edit the navigation jsp................................................................................................................................... 6 Create a java filter for WCM url .................................................................................................................... 7 Conclusion about rich state........................................................................................................................... 9 Remove the context url /wps/portal............................................................................................................... 10 Create an apache reverse proxy.................................................................................................................. 10 Enable modules ........................................................................................................................................... 10 Configure Apache as reverse proxy............................................................................................................. 10 How it works................................................................................................................................................ 11 Routing rules............................................................................................................................................ 11 Payload management.............................................................................................................................. 12 Rewrite rule explanation ......................................................................................................................... 12 Proxy Pass and mod_substitute .............................................................................................................. 13 CONCLUSION ................................................................................................................................................... 13
  • 3. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 2 Abstract In WebSphere Portal the concept around the URL are complex because are not simply URL but are RICH URL. Portal URL are structured in this way: Rich state is an xml that contain the portal state, this xml is gzipped and enconded with a modified base64 codec, the only way to decode the state in xml format is use the portal poc ( piece of content ) servlet. In this presentation http://www.socialbizug.org/files/app#/file/443ae822-48ad-40d1-b106-8750f0e79447 you could find all information about all concept around the WebSphere Portal URL, is important read this pdf to understand what you lose if a customer want full friendly SEO url and not partial like normal Portal url. What we do in this article? We want display Portal url without context and rich state, in other words : - From /wps/portal/home/shop/shoes/!ut/p/104_05dsffds90.. - To /home/shop/shoes What are the assumption we need to archive this goal? 1) Portal Page doesn’t have portlets that made a post to the same page or other page. 2) Portlet wiring attach rich state, don’t use it! 3) WCM url are cleaned with a WCM url filter, without it all WCM url have rich state. REMOVING THE RICH STATE FROM PORTAL AND WCM CONTENT In this step we configure portal to remove the rich state from Portal and WCM content. The basics of this operations are described in this wikis document: - http://www-01.ibm.com/support/knowledgecenter/SSHRKX_8.5.0/mp/admin- system/mp_friendly_short_url.dita?lang=en - http://www- 10.lotus.com/ldd/portalwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Web+Content+Manager+8+P roduct+Documentation#action=openDocument&res_title=Example_2_Generate_a_friendly_URL_f or_web_content_wcm8&content=pdcontent
  • 4. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 3 - http://www- 10.lotus.com/ldd/portalwiki.nsf/dx/Implementing_a_clean_URL_in_IBM_WebSphere_Portal_8- based_WCM_rendering Configuring portal for friendly url In the administrative console under resource environment provider click on WP ConfigService Click on custom properties
  • 5. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 4 Click on button new… Add the property into the was
  • 6. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 5 Click save Enable base url in theme In the Portal theme definition add the property <parameter name="com.ibm.portal.theme.hasBaseURL" type="string" update="set">true</parameter> add in the xmlaccess register script this parameter If you’re theme is already registered retrieve the unique name and run the xml access below <?xml version="1.0" encoding="UTF-8"?> <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_8.5.0.xsd" type="update"> <portal action="locate"> <theme action="update" uniquename="com.ibm.portal.custom.theme.theme85" > <parameter name="com.ibm.portal.theme.hasBaseURL" type="string" update="set">true</parameter> </theme> </portal> </request>
  • 7. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 6 Edit the navigation jsp In the navigation.jsp add keepNavigationalState="false" in the portal navigation tags, this particular property remove the rich state from the portal navigation URL. Search this string: - <a href="?uri=nm:oid:${nodeID}" Replace with this: - <portal-navigation:urlGeneration contentNode="${nodeID}" keepNavigationalState="false" allowRelativeURL="true"> <a href="<%wpsURL.write(out);%>" See the image below.
  • 8. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 7 After the replaced string search the first “</a>” and replace it with </a></portal-navigation:urlGeneration>, see the image below. Create a java filter for WCM url Create new dynamic project with the same projectname and ear name like the image below.
  • 9. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 8 In src package create a package named: - com.ibm.workplace.wcm.api.rewrite create into it two java class: - FriendlyUrlGenerationFilter.java - FriendlyUrlGenerationFilterFactory.java The functional sample content is located in this links: - http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Example_2_Filter_class_wcm8 - http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Example_2_Filter_factory_class_wcm8 Under the webcontent WEB-INF create the plugin.xml and write the information below: <?xml version="1.0" encoding="UTF-8"?> <plugin id="com.ibm.workplace.wcm.api.rewrite.plugin" name="URL generation filter" version="1.0.0" provider-name="IBM"> <extension point="com.ibm.workplace.wcm.api.ContentUrlGenerationFilter" id="UrlGenerationFilter"> <factory class="com.ibm.workplace.wcm.api.rewrite.FriendlyUrlGenerationFilterFactory" weight="4"/> </extension> </plugin> The structure must be like the image below. At this point you could install the ear in portal and set the startup behavior to a number upper than WCM ear startup number (normally 21 is a right number). We need to do this change to ensure the connections between WCM and the filter extension point.
  • 10. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 9 Conclusion about rich state With this four step after e Portal restart we successful remove the rich state from all page that use the theme with the customized navigation jsp and from all WCM contents.
  • 11. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 10 Remove the context url /wps/portal Websphere Portal for security reason have two area, one for anonymous users and one for authenticated users: - /wps/portal anonymous - /wps/myportal authenticated We remove the context root only for anonymous user to prevent security related problems. Create an apache reverse proxy To create an apache reverse proxy we a lot of way, personally I prefer opensuse because have a built in apache with a structured folders, in this guide http://en.opensuse.org/SDB:Apache_installation you could find all information about apache installation. After a successful installation we need to create a virtualhost as documented in the guide. Enable modules Apache 2.2 has a lot of built-in modules, opensuse by default don’t enable it when you do the first installation, to enable it you need to edit the file /etc/sysconfig/apache2 , inside it there is a variabile called APACHE_MODULES append to the end of this variabile this modules: - rewrite http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html - proxy http://httpd.apache.org/docs/2.2/mod/mod_proxy.html - proxy_http http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html - substitute http://httpd.apache.org/docs/2.2/mod/mod_substitute.html This modules are required to configure apache to act as a reverse proxy and manipulate http requests and payload. In the apache foundation site you could find all information for every modules. Configure Apache as reverse proxy Below the piece of configuration you need to configure routing and payload manipulation to the WebSphere Portal Installation request and response. # used for mantain old link in external forum and site and with a 301 redirect RewriteRule ^/holidays/old-link?$ /holidays/new-link [L,R=301] # this rewrite rule with proxy transparent use a regulare expresion to manage all context root different to the main route /wps/portal # the /wps escape all route to the servlets poc mypoc contenthandler mycontenthandler and all portlets # customThemeStatic and customThemeDynamic are the context root to my custom theme
  • 12. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 11 RewriteCond %{REQUEST_URI} !/(wps/|customThemeStatic/|customThemeDynamic/) RewriteRule ^(.*)$ /wps/portal$1 [L,PT] #this rewrite masquerade the landing page and remove the path to it RewriteCond %{HTTP_HOST} ^www.example.it RewriteCond %{REQUEST_URI} ^(/)?$ RewriteRule ^(/)?$ /wps/portal/home [PT,NC] ProxyPass / http://www.example.it/ <Location / > ProxyPassReverse http://www.example.it/ #this output filter simly parse the HTTP payload and remove /wps/portal from it, finally add /wps/portal only to the html tag base url #this is required to the portal javascript framework AddOutputFilterByType SUBSTITUTE text/html # remove /wps/portal from the payload Substitute "s|/wps/portal||nfq" # add to the base url tag /wps/portal to prevent issue with the portal javascript framework Substitute "s|www.example.it|www.example.it/wps/portal|nfq" </Location> How it works In this area we explain how the solution it works. Routing rules To archive this result we divide all uri in two groups: - All uri different from “/wps/portal” - All uri that match “/wps/portal” In the first group there are: - all common servlet like poc (/wps/poc) , mypoc (/wps/mypoc) , contenthandler (/wps/contenthandler), mycontenthandler (/wps/mycontenthandler) - all authenticated portal uri (/wps/mycontenthandler) - all portlets (/wps/PA_* ) - all predeployed portlet (/custom_context_root) - all filters, OSGI plugin and so on (/custom_context_root)
  • 13. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 12 In the second group we identify all uri that must be routed to /wps/portal. To identify this uri we must use a negative approach because with the mod_substitute we remove /wps/portal from the payload. With these assumptions we made all rewrite rule to setup the right routing. Payload management There are two possibile way to manage the payload: - Application server side with a servlet filter - HTTP Server side with HTTP Filter module We choose the second way because: - From apache 2.2 we have a built solution that provide an in memory payload rewrite with the mod_substitute. - Performance scalability, it is quite simple to install more HTTP server than install more WebSphere Portal installation. - A servlet filter interact with all HTTP request and response, portal have a set of built-in servlet filter, this means you must understand how to manage the servlet filter chain. - With a simple regular expression we could manage all routing request directly from the HTTP Server. Rewrite rule explanation This rewrite url match with a negative condition all http request that must be routed to /wps/portal RewriteCond %{REQUEST_URI} !/(wps/|customThemeStatic/|customThemeDynamic/) RewriteRule ^(.*)$ /wps/portal$1 [L,PT] This rewrite rule masquerade the homepage url RewriteCond %{HTTP_HOST} ^www.example.it RewriteCond %{REQUEST_URI} ^(/)?$ RewriteRule ^(/)?$ /wps/portal/home [PT,NC]
  • 14. Enable SEO URL in WebSphere Portal Websphere Portal SEO Friendly URL Author:Michele Buccarello Page 13 Proxy Pass and mod_substitute All HTTP request skipped in the first rewrite rule are routed with the proxy pass directive ProxyPass / http://www.example.it/ All response are manage inside the <location /> tag, inside this you could see the substitute that rewrite the payload. <Location / > ProxyPassReverse http://www.example.it/ AddOutputFilterByType SUBSTITUTE text/html Substitute "s|/wps/portal||nfq" Substitute "s|www.example.it|www.example.it/wps/portal|nfq" </Location> CONCLUSION In this article you have a way and set of rules to implement SEO url in portal, but remember what we say in the abstract, the /wps/portal don’t affect the SEO ranking of the site.