URL Aliasing using SAP Web Dispatcher

The URLs that you have to send to your customers may be long and ugly. SAP Web Dispatcher provides a way to alias the URL to something simple by using action files.

Action files are declared in the web dispatcher using icm/HTTP/mod_0
icm/HTTP/mod_0 = PREFIX=/,FILE=/path-to/action_file.txt

Assuming the url is http://<host>:<wd-port>/the-big-ugly-url-that-I-dont-want-to-expose and the alias you wish to use is http://<host>:<wd-port>/customername-1-alias

Create action_file.txt with the following content
RegIRewriteUrl ^/customername-1-alias(.*) /the-big-ugly-url-that-I-dont-want-to-expose [qsreplace]

RegIRewriteUrl indicates rewrite method is called
^/customername-1-alias(.*) is a regular expression. ^ indicates beginning with and (.*) assigns the rest of the expression to a variable $1. You can use mutiple variables as input arguments
[qsreplace] option indicates that the original query string  will be replaced by the new query string

Therefore when http://<host>:<wd-port>/customername-1-alias is called, /customername-1-alias is replaced as /the-big-ugly-url-that-I-dont-want-to-expose

If you wish to replace http://<host>:<wd-port>/the-big-ugly-url-that-I-dont-want-to-expose/variable-followup-string-that-must-be-passed, add the following line:
RegIRewriteUrl ^/customername-2-alias/(.*) /the-big-ugly-url-that-I-dont-want-to-expose/$1 [qsreplace]

When http://<host>:<wd-port>/customername-2-alias/variable-followup-string-that-must-be-passed is called, it is replaced sent as http://<host>:<wd-port>/the-big-ugly-url-that-I-dont-want-to-expose/variable-followup-string-that-must-be-passed

Comments

Popular posts from this blog

OS/DB Migration - CMD. STR, TOC, EXT, R3load, DDLDBS.TPL and more

Fixing Inconsistent Table - Table activation fails due to inconsistency between DD and DB

301 Redirect Using SAP Web Dispatcher