Just put one of these rultes at the top of your .htaccess file. Pick your favorite.

RedirectMatch 301 ^(.*) https://newdomain.com$1

RewriteRule ^(.*) https://newdomain.com$1 [R=301,L]

RewriteRule ^ https://newdomain.com%{REQUEST_URI} [R=301,L]

If you still want access to something (say adminer so you can check on the old database and to last minute stuff) use a RewriteRule method and specify conditions that exclude those resources like so:

RewriteCond %{REQUEST_URI} !^/adminer.php
RewriteRule ^ https://newdomain.com%{REQUEST_URI} [R=301,L]

Leave a Comment