Are you planning to move your website to a new domain? Whether it’s for rebranding, better SEO, or a business pivot, redirecting your entire website properly is crucial to maintain your traffic, SEO rankings, and user experience.
In this guide, we’ll show you how to redirect your entire website using a simple .htaccess
rule — ensuring that every page from your old site seamlessly forwards to the corresponding page on your new domain.
Why Redirect an Entire Website?
There are several reasons why you might want to redirect your whole website:
-
Rebranding or domain name change
-
Merging multiple domains
-
Upgrading from HTTP to HTTPS
-
Switching to a more SEO-friendly domain
Whatever your reason, a 301 redirect tells search engines that your site has permanently moved — preserving your rankings and backlinks.
What Is a 301 Redirect?
A 301 redirect is a server-side directive that tells browsers and search engines the page has permanently moved to a new location. It passes around 90-99% of link equity (ranking power) to the redirected page and is the SEO-recommended way to forward URLs.
How to Redirect an Entire Website with .htaccess
If you’re using Apache server, you can redirect all traffic from your old domain to a new one using the .htaccess
file. This file must be placed in the root directory of your old website.
Here’s the code you need:
RewriteEngine on
RewriteRule (.*) http://www.newsite.com/$1 [R=301,L]
Explanation:
-
Options +FollowSymLinks: Enables symbolic link following if not already on.
-
RewriteEngine on: Activates Apache’s URL rewriting engine.
-
RewriteRule (.*) http://www.newsite.com/$1 [R=301,L]:
-
(.*)
matches all requests (every page, image, or file). -
http://www.newsite.com/$1
redirects to the same path on the new domain. -
[R=301,L]
sets it as a permanent redirect and tells Apache to stop processing more rules (L
= Last).
-
SEO Considerations When Redirecting
-
Use 301 Redirects: Avoid 302 (temporary) redirects for domain changes.
-
Update Internal Links: Update all hard-coded links to point to the new domain.
-
Notify Google: Use Google Search Console’s “Change of Address” tool.
-
Check Backlinks: Contact high-authority sites to update backlinks if possible.
-
Monitor Traffic: Use tools like Google Analytics and Search Console to track performance after the move.
Need help redirecting your site? Contact us and we’ll help you troubleshoot!