How to redirect URLs through .htaccess? -
i want change domain name of website.
i want .htaccess redirect urls new domains in such way that:
when users click on urls http://old-domain.com/my-site-link/
redirects http://new-domain.com/my-site-link/
and when users click on urls http://old-domain.com/my-site-link.php
redirects http://new-domain.com/my-site-link.php
new domain used , old domain not.
how possible? code .htaccess?
if both domains on same account , same root folder can use this:
rewriteengine on rewritecond %{http_host} ^(www\.)?old-domain\.com$ [nc] rewriterule ^(.*)$ http://new-domain.com/$1 [r=301,qsa,l]
if domains on either different accounts or hosting services can simple add rule old domain .htaccess
.
rewriteengine on rewritebase / rewriterule ^(.*)$ http://new-domain.com/$1 [r=301,qsa,l]
Comments
Post a Comment