Redirect old domain to a new domain using .htaccess

Share This Post

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Fast Hosting as low as $2 per month

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} ^olddomain.com$ [NC] 
RewriteRule ^(.*)$ https://newdomain.net/$1 [R=301,L] 

The above code will redirect a url:

olddomain.com/about

to:

newdomain.com/about

Hopefully it helps.

Any idea? Fill the comment below

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

More To Explore