Tweaking rewrite rules to not rely on hardcoded values.