How to use mod rewrite forward to a new domain?

For examples, when we visit www.google.com, we want it redirect to http://kingphp.com, we can use the following code: Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] The code posted above should be used on the old server.

How to redirect folders (and all the link)

For example, if we want to redirct http://kingphp.com/php/ to http://kingphp.com/wordpress/ We could use mod_rewrite. Put this in your .htaccess file Options +FollowSymLinks RewriteEngine On RewriteRule /php/(\w+).html /wordpress/$1.html [R=301,L]