A client recently asked me how to redirect your homepage only and not any archive pages.
It took me a long while to figure it out, so for anyone else who’s searching for it, this is how it’s done. You need to add a line to the start of your website’s .htaccess file.
A 301 redirect won’t work as it will redirect the whole site, so you have to use a RedirectMatch. The code below will redirect the home page only to google.com, but leave any other pages and archives in place for people to come to your site.
RedirectMatch ^/$ http://google.com
There are a couple of reasons you might want to do this, so hope it helps!
17 thoughts on “How To Redirect Only Your Homepage”
Im getting the Error: Too many redirects after trying this… Can someone help me with that? What could be causing this problem??
That’s likely because the domain it’s redirecting to is on the same site, or the domain isn’t set up correctly. Occasionally it can just take time, wait a few hours and then test on a different device, domain DNS changes take a while to fully update.
Thank you – exactly what we needed to know.
Thanks! You saved my life!
How I can use redirect homepage for Blogger.
Thank you !
Hi Nicolai! I only work with WordPress.org sites so I haven’t used Blogger for many years so I don’t know if the solution to that, sorry!
Why would you want to redirect it to Google (vs. say, another website you own)?
You wouldn’t of course, that’s just an example URL. You would replace that with the site you wanted to redirect to.
Where do I place the code? ~~~
@SevenLoco It says in the article “You need to add a line to the start of your website’s .htaccess file.”
@BlogTechGuy @SevenLoco where can this be found in blogger?
@SevenLoco Unfortunately this only applies to self-hosted websites where you pay for for hosting.
Thanks for a great tip for redirecting a home page
Thanks for the help, exactly what I needed!
Cool, glad I could help!