A redirect is a simple way to automatically correct a users request to the correct page if you have moved the resource.
To make a redirect for a changed page, you need to add the following into a .htaccess file:
redirect <STATE> /old_page.name <FULLDOMAIN>/new_page.name
The <STATE> can be either
- 301 - Moved Permanently - This and all future requests should be directed to the given URI
- 307 - Temporary Redirect - In this case, the request should be repeated with another URI; however, future requests should still use the original URI.
So for example, if you wanted to permanently redirect www.example.com/smith.html to www.example.com/jones.html, you would put an .htaccess file in the web root folder of of your domain with the following:
redirect 301 /smith.html http://www.example.com/blog/jones.html
Use redirect to stop duplicate content on search engines
To prevent search engines being confused about your site, i.e. Is it http://yourdomain.com or http://www.your.domain.com, add the following to a .htaccess file
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
This will cause anyone who uses example.com to be automatically redirected to www.example.com