TECHIES WORLD

For Techs.... Techniques.... Technologies....

ApacheBashCpanelLinuxPHP

How to redirect all urls from one domain to another using .htaccess

This article explains the .htaccess configuration for redirecting all urls from one domain to another.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>

Where olddomain.com and newdomain.com need to be replaces with the appropriate domains.

Then all the traffic to "olddomain.com" will be redirected to the corresponding urls in "newdomain.com".

That's all…