Redirecting Old Website to New Website using .htaccess

September 15, 2018| PhantomThemes Editorial

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
Categories: Uncategorized

Leave a Reply

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

Rating*