How to redirect one domain to another domain using .htaccess?
How to redirects Doamin from old to new domain?
If you want to redirects a domain to new domain, you can do that by modifying .htaccess file. You can redirect all pages or URL to new domain.
Here, this one redirects everything after the domain name on the URL to the exact same copy on the new domain URL:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^YourDomain.example$ [NC]
RewriteRule ^(.*)$ https://YourDomain.example/$1 [R=301,L]
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>