How to redirect a domain name using .htaccess

If your domain name is changed for some reason and you want users/search engines to redirect to new Location then add the below code in .htaccess file of your website.


If you want to redirect to

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule (.*)${REQUEST_URI} [R=301,L]

After you add above code in .htaccess file it will as also redirect links.
Example: will redirect to

Leave a Reply

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