Improved generation of the Apache rewrite frament.