Redirect all traffic to root of another domain Redirect all traffic to root of another domain apache apache

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 +FollowSymLinksRewriteEngine onRewriteRule (.*) http://www.newdomain.com/ [R=301,L]

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

Options +FollowSymLinksRewriteEngine onRewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]


Put this code in your ROOT .htaccess on www.old.com

Options +FollowSymLinks -MultiViewsRewriteEngine onRewriteCond %{HTTP_HOST} ^(www\.)?old\.com$ [NC]RewriteRule ^ http://www.new.com/ [R=301,L]

This rule will externally redirect all www.old.com/* to www.new.com/