Making a Redirect 301 Directive
Move a web page and links break.
Spiders can't find the page anymore. You give a 404 to everybody who tries to load the missing page.
Fix it with a Redirect 301 directive in the .htaccess file. Redirect traffic to the new location.
How To Create a Redirect 301 Directive
First, make a note of the URL the missing page had and the URL the page was moved to. For use in our example, let's assume the URLs are:
http://example.com/old.html
http://example.com/new.html
The Redirect 301 directive is all one line. Start the line with
redirect 301
Append a space and the directory location of the missing page. The directory location is the URL with the http:// and domain name removed.
redirect 301 /old.html
Last, append a space and the URL the page was moved to.
redirect 301 /old.html http://example.com/new.html
That's the entire directive.
Insert the Redirect 301 directive into the .htaccess file located in your server's document root directory. (The document root is the directory where your domain's main or index page is located.)
To recap, the Redirect 301 directive has 4 parts, each separated with a space:
- The word "redirect"
- The number "301"
- The directory location the missing web page used to be.
- The URL the page was moved to.
If you rename most of the pages on your website and find yourself creating dozens or hundreds of Redirect 301 directive, consider using the "redirect 301" generator in the WebSite's Secret membership area. For a view of the control panel, click here.
Will Bontrager