How to build links compatible with clean and "dirty" URLs?
You should be able to define such Links with the menu_hook

http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_menu/7

Especially lookt at the Wildcard options i used them recently to define own urls