eHow launches Android app: Get the best of eHow on the go.

How To

How to Redirect a Web Page to Another

Contributor
By Foye
eHow Contributing Writer
(0 Ratings)

Redirecting a web page to a different web address can save you time and energy. This is especially true if you have a number of websites that you need to route to one location, or if you've recently changed web addresses and need to send your visitors to your new site. You don't want to lose your old/new customers or have to recreate your website.

Difficulty: Moderately Easy
Instructions

    Method 1 -- Use a Permanent Redirect (301 Redirect)

  1. Step 1

    To create a permanent redirect, create a file called ".htaccess" in the folder you want redirected (if there's not one on the web server already). Otherwise, download the .htaccess file that's already in the folder of your web server to your local computer.

  2. Step 2

    Using a plain text editor, add the following code inside the .htaccess file of the new file you're creating, or add the code before the existing code of an existing .htaccess file:
    redirect permanent /path/location/of/file URL-of-the-new-page

  3. Step 3

    To add other web pages you want to redirect, add them below the first line of code. To redirect all the pages in a folder, simply leave the file name off.

  4. Step 4

    Save the file as .htaccess.

  5. Step 5

    Upload it to your web server to the folder the redirect applies to.

  6. Method 2 -- Use a Temporary Redirect (302 Redirect)

  7. Step 1

    Follow the steps in Method 1, but replace the code with the following in your .htaccess file:
    redirect temp /path/location/of/file URL-of-the-new-page

  8. Step 2

    Replace the path and files with the correct ones.

  9. Step 3

    Save the .htaccess file.

  10. Step 4

    Upload it to the web server (to the applicable folder).

  11. Method 3 -- Use JavaScript Code to Redirect Your Web Page

  12. Step 1

    Open your HTML document with your favorite text editor.

  13. Step 2

    Place the following code between the <HEAD> tags, and replace the web address and location with the ones you want to use.
    <script language="javascript" type="text/javascript">
    <!--
    window.location="http://www.websiteaddress.com/folder/";
    // -->
    </script>

  14. Step 3

    To redirect your web page elsewhere after a few seconds in the same window, use the following code (replacing the web address and number of seconds with the correct one) within the <HEAD> tag:

    <script language="javascript" type="text/javascript">
    <!--
    window.setTimeout('window.location="http://www.websiteaddress.com/folder/"; ',5000);
    // -->
    </script>
    The above code will automatically redirect your web page to the specified location after 5 seconds.

  15. Step 4

    Save your HTML file.

  16. Step 5

    Publish the file to the web.

Tips & Warnings
  • A permanent redirect (301) is search-engine friendly. Your site does not get penalized for the redirect by losing its rank on search engines.
Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Tags
Get Free Internet Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy.   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

Demand Media
eHow_eHow Technology and Electronics