Redirect all traffic to root of another domain

From http://www.webconfs.com/how-to-redirect-a-webpage.php I’d say you can use the following configuration

Don’t redirect subfolders/files (as you wanted): www.example.com/demo/ -> www.newexampledomain.com

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/ [R=301,L]

Redirect to subfolders/files: www.example.com/demo/ -> www.newexampledomain.com/demo/

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

Leave a Comment