I want to redirect all requests on my old domain to the homepage (root site) of my new domain. I thought it would work with a:
RewriteEngine On
RewriteRule ^(.*)$ http://newdomain.com/ [R=301]
(see: .htaccess redirect all pages to new domain) but for a strange reason, when I try for example to access the URL www.olddomain.com/faq/pdf.php?cat=7&id=93&artlang=de I get redirected to www.newdomain.com/?cat=7&id=93&artlang=de. What could be the problem?
In the past I had some problems because this domain is in a subdirectory (as addon-domain) of my new main-domain, but in the .htaccess of the main-domain I've got a:
RewriteCond %{HTTP_HOST} ^([^.]+\.)*olddomain\.com
RewriteRule .* - [L]
Which disable this kind of errors. Any other ideas? I'm trying this now since hours.
EDIT: I've googled when I got that the problem is the query string.
If you want to redirect to your new domain without path and query string, you must append an empty query string
RewriteEngine On
RewriteRule .* http://newdomain.com/? [R=301,L]