Htaccess: Redirect Sub-Directory of One Domain to Another Domain

If you want to redirect the sub-directory /test/1234 under your current domain and all the files under it to www.example.com/test/1234 in a way that you don’t lose any of the google link juice, then you can add the following code snippet to your .htaccess.

<IfModule mod_rewrite.c%gt;
RewriteEngine On
RewriteCond %{REQUEST_URI} /test/1234 [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
</IfModule>>