fix rewrites in or to subdirectories