1. Home
  2. Computing & Technology
  3. Web Design / HTML

Set Up a 302 Redirect with HTAccess on Apache

By , About.com Guide

If you want to set up a temporary redirect to help your pages rank better in search engines, you should set up a 302 Server Redirect. But you don't need server programming to set one up, just a simple text file on your Apache Web server.

Difficulty: Average
Time Required: 5 minutes
Here's How:
  1. If you don't have a .htaccess file in your root directory, open a new text file. If you do have one there, open it for editing.
  2. At the bottom of the file, add the line:
    Redirect 302 /PATH_TO_REDIRECT NEW_LOCATION_URI
  3. Change "/PATH_TO_REDIRECT" to the directory path on your Web server you want redirected.
  4. Change "NEW_LOCATION_URI" to the URL path you want the pages redirected to.
  5. Save your .htaccess file and upload it to the root of your Web server.
  6. Test your redirect by going to the old path in a Web browser. You should be taken automatically to the new path.
Tips:
  1. You should only use 302 redirects to set up temporary redirects, such as to clean up ugly URLs.
  2. If you want the URL to change in the search engine, use a 301 redirect.
What You Need:
  • HTAccess
Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. Web Server Management
  5. HTAccess
  6. How to Set Up a 302 Redirect with HTAccess on Apache>

©2009 About.com, a part of The New York Times Company.

All rights reserved.