: 301 redirect whole site to the homepage of another? 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
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 / 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?
More posts by @Ogunnowo487
1 Comments
Sorted by latest first Latest Oldest Best
This will do the trick in .htaccess provided you have mod_rewrite module installed:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ www.example2.com/? [R=301,L]
Just replace example with your domain and example2.com with the new domain to redirect to.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.