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

H

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

About the author

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.

About Author

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.

Follow Me