I want to redirect my entire website to a new unique address/domain without respecting the relation between filenames.
I don't want olddomain.com/foo.html
to be redirected to newdomain.com/foo.html
.
I want this result with a htaccess file:
olddomain.com/foo.html => newdomain.com
olddomain.com/foo/bar.html => newdomain.com
olddomain.com/a/b/c/moo.html => newdomain.com
The Redirect 301
function of htaccess does exactly what I don't want.
How I can proceed?
Answer to the RavinderSingh13's comment:
This is what I tried so far:
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ https://www.newdomain.com/$1 [R=301,L]
And :
Redirect 301 / https://www.newdomain.com/
And also :
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.comfr$
RewriteRule ^/?$ "https\:\/\/www\.newdomain\.com/" [R=301,L]