Which redirect rule would I use to redirect all pages under olddomain.example
to be redirected to newdomain.example
?
The site has a totally
If the new domain you are redirecting your old site to is on a diffrent host, you can simply use a Redirect
Redirect 301 / http://newdomain.com
This will redirect all requests from olddomain
to the newdomain
.
Redirect
directive will not work or may cause a Redirect loop
if your newdomain and olddomain both are on same host, in that case you'll need to use mod-rewrite
to redirect based on the requested host header.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$
RewriteRule ^ http://newdomain.com%{REQUEST_URI} [NE,L,R]