Adding 301 permanent redirect code

If you want to redirect all pages of an entire site to the main page of another domain, add the following code to your .htaccess file:
RedirectMatch 301 (.*) http://www.example.com/

The .htaccess file should be stored in the same location as the index page to your OLD domain that you are redirecting from.

If you want to redirect one page to another page:
redirect 301 /old-file-name.htm http://www.example.com/new-file-name.htm

If the old page is within a different directory (folder) as your index page, then you would need to adjust the path of the old file name accordingly.

For example, if the old file name is located within a directory named category, your code would be as follows:
redirect 301 /category/old-file-name.htm http://www.example.com/new-file-name.htm

If the old page is within a different directory (folder) as your index page, and you also want the new page within that same directory, then you would need to adjust the path of the old and new file name accordingly.

For example, if the old file name is located within a directory named category, and the new page will be also, your code would be as follows:
redirect 301 /category/old-file-name.htm http://www.example.com/category/new-file-name.htm

Again, make sure you save any changes you’ve made.