This is why I tried to avoid htaccess. But I was wondering if there was a tweak I could do to make it work in functions.php