Context can be important with rewrite rules. If your RewriteCond is in a
.htaccess file or inside a
<Directory > block, there is no leading slash on the URI. If it is in any other part of the Apache configuration, the URI will begin with a slash.
The reason for this is that in a directory context, the file path leading up to the directory in question is removed and that path always ends in a slash.
In your case, there is also all of this:
/cgi-bin/hsrun.exe/Distributed/ before the
Postphil bit but you require the URI to start with
postphil so the RewriteCond will not match for that reason either.
The end of the regex (
l+ ) mean "one or more l" which is also a bit weird but since it does match a single 'l' that part should work.
If all you want is exactly what you said: "If the path contains the folder /postphil I want to redirect to a new domain" then this will do the trick, no need for a RewriteCond:
RewriteRule postphil https://www.newdomain.com/ [NC,R,L]
I used a 302 redirect rather than a 301 because browsers cache 301s. Even if you change the target of the redirect, if your browser has already seen a 301 for that URL it will just go straight there. You can change it to a 301 once you have finished testing and are happy that it works properly.