.htaccess redirect from old domain to new domain

Htaccess is a powerful tool. Simplest mistake in syntax can cause problems. In this post i am talking about the permanent redirect, ie 301 redirect of old domain to new domain.

Case 1: if you need to keep the url structure of old domain in the new one

eg: gets redirected to

Do this: if you plan to keep the url structure

+ve: Helps to retain the seo

Redirect 301 /

Case 2: if you don’t need the url structure

eg: gets redirected to http://newdomain

Do this: if you dont plan to keep the url structure

RewriteEngine On
RewriteRule ^(.*)$ [R=301]

Enjoy smile

Let's discuss now...

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