Redirect old domain to a new domain using .htaccess

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp

Last Updated: April 6, 2021 | Reading Time: < 1 minute

To redirect an entire old domain and all urls to a new domain, just paste the following code into the top of .htaccess file:

Options +FollowSymLinks
RewriteEngine On 
RewriteBase / 
RewriteCond %{HTTP_HOST} ^$ [NC] 
RewriteRule ^(.*)$$1 [R=301,L] 

The above code will redirect a url:


Hopefully it helps.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.