PUPUNGBP

Redirect old domain to a new domain using .htaccess

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.

Leave a Reply

Your email address will not be published.

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