How to redirect your whole website using 301 redirect within the .htaccess file

Written by Ian Carnaghan · 13 sec read >

In your Document root open the .htaccess file if present otherwise create a .htaccess file

Once the file is open edit the contents of the file and add the following code to it

Redirect 301 / http://yoursite.com/

Replace the url with your url where you want your website to be redirected to.

Upload the .htaccess file and test, the redirection should work

Last Updated On March 22, 2018
Written by Ian Carnaghan
I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment. Profile

Leave a Reply

Notify of