I would like to redirect my whole site to the homepage of another site. I know I could do this in JavaScript but I prefer to have the 301 Redirect for SEO reasons. How could I do this while maintaining the 301 redirect?

At the moment I changed the .htaccess file with:

Redirect 301 / http://www.newdomain.com/

but when someone types olddomain.com/something/ instead of going into the homepage of the new site, they go to newdomain.com/something/.

How can I fix this while maintaining the 301 redirect for SEO reasons?

  • Redirecting en masse to a single page may not have the SEO benefit you're expecting. Sep 23, 2015 at 9:03

1 Answer 1


This will do the trick in .htaccess provided you have mod_rewrite module installed:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example2.com/? [R=301,L]

Just replace example with your domain and example2.com with the new domain to redirect to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.