Redirect only WordPress homepage with a 301 redirect

A client recently requested information on how to redirect only the homepage of their website, while leaving archive pages in place. After some research, the solution was found to be utilizing a RedirectMatch in the website’s .htaccess file.

A 301 redirect is not suitable for this task as it would redirect the entire site. The following code will redirect the homepage to google.com, while leaving other pages and archives accessible to visitors:

RedirectMatch ^/$ http://google.com

This technique may be useful for various reasons and we hope it will assist others in similar situations.

 

Welcome to the world of DomainRooster, where roosters (and hens) rule the roost! We're a one-stop shop for all your entrepreneurial needs, bringing together domain names and website hosting, and all the tools you need to bring your ideas to life. With our help, you'll soar to new heights and hatch great success. Think of us as your trusty sidekick, always there to lend a wing and help you navigate the sometimes-complex world of domain names and web hosting. Our team of roosters are experts in their fields and are always on hand to answer any questions and provide guidance. So why wait? Sign up today and join the ranks of the world's greatest entrepreneurs. With DomainRooster, the sky's the limit! And remember, as the saying goes, "Successful people do what unsuccessful people are not willing to do." So don't be afraid to take that leap of faith - DomainRooster is here to help you reach for the stars. Caw on!