I've two web-sites: xxx.com and yyy.com

Both of them have similar web applications, but on different servers. I wish to make Apache redirect all path demands to xxx.com much the same way to yyy.com.

For instance:

1. Request:     xxx.com/pages/contacts
   Redirects to yyy.com/pages/contacts
2. Request:     xxx.com/search?first_val=45&second_val=45
   Redirects to yyy.com/search?first_val=45&second_val=45

So, can there be in whatever way to create such .htaccess file? And when yes, show me how to get this done, please :)

Try something similar to this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.xxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^xxx.com$
RewriteRule ^(.*)$ http://www.yyy.com/$1 [R=301,L]