• Home
  • About Us
  • Digital Marketing Terms
  • Free Tech Support
  • Contact Us
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

My Code Snippets

Real Answers From Real Developers

  • WordPress General
  • Divi Builder Tutorials
  • WordPress Plugins
  • Local SEO
  • Show Search
Hide Search

How To Redirect An Entire Website Using htaccess

code-admin · September 23, 2020 · Leave a Comment

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]

 

Filed Under: WordPress Code

You May Also Like

How To Install Google Analytics 4
How To Install Google Analytics 4 In 7 Easy Steps

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • The Site is Experiencing Technical Difficulties WordPress
  • Using Flexbox CSS To Center Elements
  • Divi Header Transparent Menu
  • Divi Builder Not Working With Cloudflare CDN
  • Divi Visual Builder Not Saving Changes

Recent Comments

  • Jackie on How to Fix The Jumping Header Issue Divi Builder
  • Kate on Divi Builder Not Working With Cloudflare CDN
  • Mimi Cartee on Can’t Change The WordPress Admin Email Address

Archives

  • November 2021
  • June 2021
  • May 2021
  • March 2021
  • January 2021
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • March 2020
  • October 2019
  • September 2019
  • May 2019

Categories

  • Digital Marketing
  • Digital Marketing During Covid-19
  • Digital Technology
  • Divi Builder Resources
  • Divi Builder Tutorials
  • Gravity Forms
  • Gravity Forms Snippets
  • Local SEO
  • Social Media Marketing
  • Social Media Trends 2021
  • Uncategorized
  • WooCommerce Snippets
  • WordPress Code
  • WordPress Experts
  • WordPress Plugins
  • WordPress Technology
  • WordPress Themes
  • WordPress Troubleshooting

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2022 · Daily Dish Pro on Genesis Framework · WordPress · Log in