added check for html extension when rewriting tags