Which redirect rule would I use to redirect all pages under olddomain.example
to be redirected to newdomain.example
?
The site has a totally
Simple just like this and this will not carry the trailing query from URL to new domain.
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule .* https://www.newdomain.com/? [R=301,L]
Try this methode to redirect all to homepage new domain, Its works for me:
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule ^(.*)$ "https\:\/\/newdomain\.com\/" [R=301,L]
If you want to redirect from some location to subdomain you can use:
Redirect 301 /Old-Location/ http://subdomain.yourdomain.com
If you want redirect to complete new different site (domain) with no parameters or pages, use this:
RewriteEngine On
RewriteRule / http://new-domain.com/$1? [R=301]
May be like this:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^OLDDOMAIN\.com$ [NC]
RewriteRule ^(.*)$ http://NEWDOMAIN.com [R=301,L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>
This worked for me