
When you migrate your website from old domain to new one, you want to preserve the link traffic to new web address. In Apache web server we use Apache Rewrite Rules to add the redirection features. The file with this type of rules added into file name .htaccess
The apache codes to add this features are as follows:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^odlwebsite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.newwebsite.com$
RewriteRule (.*)$ http://www.newwebsite.com/$1 [R=301,L]
If you just want to redirect the single page address, the code will be as follows:
Redirect 301 /old-post-page.html http://www.newwebsite.com/new-page.html
One thought on “Redirecting Old Website to New Website using .htaccess”
Hello,
Thank you but
I have old site let’s say https://abc.com and my new site is http://ab-c.com.
How do i Redirect this?