ASU Web Community

How to Create a 301 Redirect

kdmarks's picture

If you need to move a page or a whole website, a 301 redirect is always recommended. Using a 301 redirect is the "polite" and friendly way to tell search engines and humans where to find the new page. (Avoid using a meta redirect tag, which is a spam technique to increase page rankings and can get your page filtered out of search indexes.)

To Create a 301 Redirect

1. Locate an existing .htaccess file or create a new one. Your .htaccess file gives search engine robots instructions on security and redirects.

2. If you don't have an .htaccess file on your server, you can easily create one. Using a text editor like Notepad or TextEdit, create a new text file and name it ".htaccess"

3. If there is already an .htaccess file, scroll past existing code, leave a line space, and start your new redirect instructions at the end.

4. Here are a few examples of 301 redirects you can use. The first file path (in red) is the location of the file being moved and the second path (in blue) is where the file is being moved.

To redirect a single file:

redirect 301 /old-directory/old-file.html http://www.domain.com/directory/file.html

To redirect an entire folder:

redirect 301 /old-directory/old-directory/ http://www.domain.com/directory/directory/

To redirect an entire site:

redirect 301 / http://www.new_domain.com/

5. Upload the .htaccess file to your (old) server.