Redirect File Or Directory

Using htaccess, you can automatically redirect a file or directory on your server. For example, if you’ve moved the location of a page on your website, you can use this:

redirect 301 /oldfiles/mypage.html http://www.example.com/newfiles/mypage.html

In the above example, you first specify the path to the old file, then specify the URL of the new file. Anytime someone tries to access the old file, they will automatically be redirected.

You can also redirect an entire directory using the same principle:

Redirect permanent /oldfiles/ http://www.example.com/newfiles/

Redirection is not limited to files on your server. You can redirect any page or directory to a completely different website if you wish.