There are numerous way to program a redirect using the .htaccess file. However, we found it difficult to find code that actually redirects an entire website. No matter what the user types in from the URL bar, this script accomplishes how to redirect an entire website to a new website. Insert the following code in your .htaccess file. Be sure to delete any unnecessary white space from the top or bottom of the file. Let us know how it works in the comments below.
RewriteEngine on RewriteCond %{http_host} ^www.oldsite.com [NC,OR] RewriteCond %{http_host} ^oldsite.com [NC] RewriteRule ^(.*)$ https://newsite.com/ [R=301,NC,L]
Leave a Reply