Defining friendly URLs without state information for pages in your site | HCL Digital Experience

The Configuration Wizard option for Modifying Site URLs for Search Engine Optimization makes it possible to remove navigational state information from your site URLs site wide. To enable friendly URLs without state information at the page level, you must complete extra steps after you use this option.

Before you begin

If you are on Combined Cumulative Fix 4 or earlier, go to CF04 and earlier: Using friendly URLs without state information.

If you are on Combined Cumulative Fixcombined cumulative fix 7 or earlier, go to CF07 and earlier: Using friendly URLs without state information.

Remove the URL generation filter if you previously installed it. For information, read Example 2: Generate a friendly URL for web content.

About this task

Note: The procedure is applicable from Portal 8.5, 9.0, and 9.5 later versions.

Procedure

  1. Follow the below steps to remove the URL state only on portal pages:
      1. On WAS admin console, under Resources > Resource Environment providers > WP ConfigService > Custom properties
        1. Add property: stateless.urls.enabled
        2. Set the value to true.
      2. Restart the server. (above change only takes effect after a server restart.)
      3. Add hasBaseURL to the theme. In your environment you will need to add this to the theme for your page.
        To add this property to the theme, you need to use XMLAccess.
        1. Create a file named importFile.xml with this content:
          <?xml version="1.0" encoding="UTG-8"?>
          
          <request
          	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          	xsi:noNamespaceSchemaLocation="PortalConfig_8.5.0.xsd"
          type="update">
          
          	<!-- This sample sets the hasBaseURL parameter in the Portal 8.5 Theme. -->
          	<portal action="locate">
          		<theme action="update" uniquename="ibm.portal.85Theme" >
          			<parameter name="com.ibm.portal.theme.hasBaseURL"
          				type="string" update="set">true</parameter>
          		</theme>
          	</portal>
          </request>
        2. Replace the uniquename value with the uniquename for your theme.
        3. Import the file using xmlaccess import command under /opt/IBM/WebSphere/PortalServer/bin:
          ./xmlaccess.sh -user wpsadmin -password wpsadmin -url http://host:port/wps/config -in /opt/IBM/WebSphere/PortalServer/bin/importFile.xml -out result.xml
        4. Replace the values for -user and -password with the user and password for your server. For more information refer How to prevent friendly URL redirects for invalid friendly URLs for web content.
          Note: Above steps are global changes. The first one affects the entire installation and the second one affects the theme. However they won't work unless you set next property on the pages.
      4. Add generate.stateless.urls on the pages.
        1. Go to Administration > Manage Pages, then navigate to the page where you want to remove the url state and then click on Edit page properties.
        2. Expand Advanced options and click I want to set parameters.
        3. Add generate.stateless.urls with value true, then click OK.
        Note: If you add this on a parent page all it's child pages will inherit the parameter. So you only need to set this on your top level pages. If you want to keep the state on a specific child page, follow step 4 on the child page, but set the parameter to false.
  2. Define friendly URL names for pages.
    You can configure a friendly URL at the page level from the site toolbar or from Manage Pages administration portlet.
    • To define friendly URLs for your pages from Administration, go to Using friendly URLs.
    • To define friendly URLs for your pages from the site toolbar, use the following instructions:
      1. Turn on edit mode from the action bar. Site Manager opens automatically. If Site Manager does not open automatically, click the Site Manager icon Screen capture of the Site Manager icon to open it.
      2. In Site Manager, click the page for which you are defining a friendly URL name. Then, click the context menu icon Screen capture of the context menu.
      3. From the context menu, click Open Page Settings.
      4. From the General tab, click Edit by Edit Page Properties.
      5. In the Friendly URL name entry field, enter the name of the page as you want it to appear in the friendly URL.
      6. Click Save.
  3. Associate pages that render web content with the default site area of that web content. Complete the following steps to generate friendly URLs for that web content:
    1. Turn on edit mode from the action bar. Site Manager opens automatically. If Site Manager does not open automatically, click the Site Manager icon to open it.
    2. In Site Manager, click the page that contains the web content viewer that is used to render the web content you want to generate friendly URLs for. Then, click the context menu icon.
    3. From the context menu, click Open Page Settings.
    4. From Details tab, click Edit by Default site area.
    5. On the Manage Associated Content page, click Add web content to select the site area of your web content or one of the parent site areas.
    6. From the list of associated content, select the newly added site area association by clicking the radio button.
    7. Click OK.
  4. Optional: You might want to present language-specific portal pages with stateless friendly URLs to your site visitors. In this case, structure your portal site to reflect which pages are targeted for specific countries or regions. You can create a node for a specific page, and then create language-specific child pages under that node.
    For example, in the node home, you create pages in English, French, and German. Your site visitors can then access the page in their preferred language by using one of the following friendly URLs:
    • http://www.cntserv_exmp.com/wps/home/en/shop
    • http://www.cntserv_exmp.com/wps/home/fr/shop
    • http://www.cntserv_exmp.com/wps/home/de/shop

What to do next

You can configure themes to display only short URLs without state information. You can configure pages that use that theme to display friendly URLs.