Clean URLs

The HTTP API and Templating Engine both support URL rewriting, which is optional, but recommended. Check it out:

A cool URI befitting of the Mobots

Using the HTTP API as an example, some normal URLs might look like this:

http://my_cdm_server/dmapi/?r=objects/uw/3
http://my_cdm_server/dmclient/?r=uw/3

With URL rewrite support enabled, these would become:

http://my_cdm_server/dmapi/objects/uw/3
http://my_cdm_server/dmclient/uw/3

The latter are cleaner and more "taxonomically correct," if you will. They go further toward hiding your implementation details, which is a good thing. They become uniform resource identifiers rather than just lowly locators.

URL rewriting is easy to get working on both Apache and IIS. On Apache, it requires the mod_rewrite module to be enabled in httpd.conf. On IIS, there are a few different options, but one that we have minor experience with is ISAPI Rewrite. The free Lite version does not support .htaccess files, but it's easy enough to add global rules instead. Here is a sample set:

RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/dm/objects(.*)$ /dm/objects/index.php?q=$1 [L,QSA]

This gets saved in C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf. Naturally, you want to change /dm/objects to the path to your template engine. You can use the same rules in your Apache httpd.conf as well if you can't or don't want to use .htaccess files. (Keep reading.)

The dmBridge template engine includes a .htaccess file which the web server should read (if it is configured to do so; in Apache, see the AllowOverride directive in httpd.conf). This is all that is needed; just enable rewriting in dm/objects/config.xml and it will be enabled in all of your template sets. Do the same thing in dm/api/config.php as well and it will be enabled in the HTTP API, too.

If you are worried about the performance impact of enabling .htaccess files, they will typically add less than a few thousandths of a second to each page request, depending on the performance of the server and the depth of the folder in the filesystem.