Forum Topic: How to redirect an entire site?
I’m moving my files to a new domain, what is the best way to redirect all requests from, say, http://oldsite.com/
to http://newsite.com
?
1 Reply to “How to redirect an entire site?”
There are two common scenarios for redirecting entire sites. First, if only the domain-name is changing and all files will be available on the new site, then use Redirect
, like so:
Redirect 301 / http://newsite.com/
When included in the root .htaccess file of oldsite.com
, that directive will redirect each request to the same resources at newsite.com
.
The other common scenario when redirecting entire sites is the case where all requests are redirected to the homepage of newsite.com
. For this, use RedirectMacth
:
RedirectMatch 301 / http://newsite.com/
When included in the root .htaccess file of oldsite.com
, that directive will redirect each request to http://newsite.com/
, which is easily edited to be any URL you’d like.