Reputation: 323
I have an old website that I want to redirect to a new domain. I don't have the same structure, so I simply want all the pages to redirect to the homepage. Links on the old website looks like this: information.php?s=91. When I redirect the site everything works perfectly, except ?s=91 still remains. I want to get rid of this as well, since this performs a search on the site, rather than pointing it to the homepage.
This is how my .htaccess looks like:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^oldsite\.com$ [NC]
RewriteRule ^(.*)$ http://newsite.com [R=301,L]
Upvotes: 1
Views: 392
Reputation: 785276
You can use:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^oldsite\.com$ [NC]
RewriteRule ^ http://newsite.com/? [R=301,L]
Trailing ?
will strip off previous query string.
Upvotes: 1