Redirect a directory in a forwarded domain to another url with htaccess
<p>Trying to get a directory in a forwarded domain to redirect to a new page in a url, while maintaining a rule that the rest of the site get redirected to the root of the new url.</p>

<p>This is the current code on the htaccess</p>

<pre><code>RewriteCond %{HTTP_HOST} ^.*forwardeddomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.mainsite.com [R=301,L]
</code></pre>

<p>This forwards anything in the forwarded domain to the main site. But now they need to add an exemption rule to forward one directory url in that domain to another part of the main site. I tried this code, but it doesn't work:</p>

<pre><code>RewriteCond %{HTTP_HOST} ^.*forwardeddomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.mainsite.com [R=301,L]
redirect 301 forwardeddomain.com/example/ http://www.mainsite.com/example.html
</code></pre>

<p>Haven't found anything in search for this particular issue. I don't have access to the domain registries, only ftp and htaccess.</p>

<p>In other words:</p>

<p><code>forwardeddomain.com</code> and <code>forwardeddomain.com/anything/</code> should forward to <code>mainsite.com</code>, but only <code>forwardeddomain.com/example/</code> should forward to <code>mainsite.com/example.html</code></p>