final rewriting of template now implemented as a standard rewrite rule