How to redirect all urls and traffic from one domain to another using .htaccess.

Global Redirect of all urls from one domain to another in .htaccess

Often we find ourselves needing to redirect all traffic from one domain, no matter what page is hit, to a completely different domain.


Would all need to redirect to:

To do this, you can add the following to your .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule (.*)$$1 [R=301,L]

If processed correctly, you should now have a global direct from one domain to the other now in place.

Place this as close to the top of your directives in your .htaccess file. If you find yourself having trouble, try to remove everything else in your .htaccess file and see if the redirects process for you, then you can troubleshoot where your conflict is in the .htaccess file.

As always, if you need a paid consult, just use the form below and we’ll see if we can help.

Contact us today!

  • This field is for validation purposes and should be left unchanged.