Forum Moderators: phranque
RewriteCond %{HTTP_HOST} ^www.testurl.com$ [NC]
RewriteCond /targetdir$
RewriteRule ^http://diffsub.testurl.com/targetdir/ [R=301] RewriteCond /targetdir$
<snip>
but I'm getting 500s.
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^targetdir/?$ http://diffsub.example.com/targetdir/ [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteRule ^targetdir/?$ http://diffsub.example.com/targetdir/ [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^targetdir/?$ http:/ /diffsub.example.com/targetdir/
RewriteCond TestString CondPattern
...
CondPattern is the condition pattern, a regular expression which is applied to the current instance of the TestString. TestString is first evaluated, before being matched against CondPattern.
CondPattern is usually a perl compatible regular expression, but there is additional syntax available to perform other useful tests against the Teststring:
...
RewriteRule Pattern Substitution [flags]
...
Pattern is a perl compatible regular expression. On the first RewriteRule, it is matched against the (%-decoded) URL-path (or file-path, depending on the context) of the request. Subsequent patterns are matched against the output of the last matching RewriteRule.
...