Web Programming

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.