.htaccess Forward to New Domain with URL Parameters

If you move your web page to a new domain, you may want to forward users (and search engines in particular) that still access your page via the old domain to the new domain. However, if you use an underlying CMS or blog system you will want to keep the parameters after the domain name. E.g., if someone called you would want to forward it to For this purpose, I found the following .htaccess snippet handy:

Options +FollowSymlinks
RewriteEngine On

#if domain is
RewriteCond %{HTTP_HOST}$ [NC] #NC means non case sensitive

#...forward to and preserve parameters
RewriteRule ^(.*)$$1 [R=301,NC,L] #R=301 redirects and sends HTTP status 301 (resource permanently moved, important for search engines) and L means stop processing following htaccess stuff

If you know or figure out a better way to establish this, please let me know in the comments.

By Johannes Luderschmidt