added rewrite for permalinks