How can I redirect to a different domain without changing the URL in the address bar?

Solution 1:

No, there isn't a way to do this with .htaccess. Doing so would present a glaring security hole - imagine someone doing this with a bank's website!

Solution 2:

If both are hosted on the same server, do this in your .htaccess:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^domain1.com$
  RewriteRule (.*)$ http://www.domain2.com$1 [P]
</IfModule>

Solution 3:

If you own both domain1 and domain2, you could accomplish this through domain name forwarding. Check your domain name registrar (like godaddy.com) for the options.

No, you can not do it through htaccess file.