How to Write a Redirect Page Script

Save

A redirect script is a handy way to tell an old web page to send visitors to a new web page. There are many reasons you'd want to use a redirect script--to rename the page, to move to a new web design platform, or to redirect to an affiliate link, for example. Since old pages may be listed in search engines or bookmarked by visitors, providing a redirect script will allow them to access the new pages and not receive an error message. In the case of affiliate links, a redirect script allows you to provide an easy-to-use URL on your domain that gets redirected to a more complicated affiliate URL.

HTML Redirect Script

  • Locate the page you want to redirect to. For example, if you want to redirect www.yoursite.com/page1.htm to www.yoursite.com/page2, pull the /page2 up in your browser.

  • Open the page you want to redirect in your FTP, file manager or web page editor. If you use an FTP software, connect to your server, highlight the file, and click on \"Edit.\" If you have a host provider with cPanel, you can open the page and edit from your file manager. Or open the page in your web editor.

  • Paste the following in between the <head> and </header> of the page <meta HTTP-EQUIV=\"REFRESH\" content=\"0; URL=http://www.yourdomain.com/pagetoredirectto\&quot;>. Put the page you want to redirect to in the place of http://www.yourdomain.com/pagetoredirectto. For example, if you're redirecting to www.yourdomain.com/page2, you'd put that (with the http://). An easy way to do this is to copy the URL of the webpage you want to redirect to (Step 1) and paste it. If you don't want instant redirect, you can change the \"0\" to the number of seconds you want. Then save the file.

  • Delete other items on the page. Unless you want the visitor to view the page for a few seconds (see Step 3), you can get rid of anything else in the <header> </header>section as well as in the <body> </body> section. You can keep the <html> </html> tags at the beginning and end. But all other information except the script can be removed.

  • Test that it works. Type in the old URL and make sure it takes you to the new URL. If not, check that you entered the URL correctly. You may need to \"refresh\" the page to have the redirect work.

PHP Redirect

  • Find the webpage you want to redirect to in your web browser. This will make for easy cut and paste into the script.

  • Open your file in your FTP, file manager or web editor (as in Step 2 above).

  • Remove everything on the page. The PHP script works only if it's the only code on the page. Remove even the <html> </html> tags.

  • Copy and paste the PHP script into the the file. Change the URL (the http://www.yoursite.com/new_page.html') to the page you want to redirect to. Then save.

    <?php

    header( 'Location: http://www.yoursite.com/new_page.html' )
    GO

    ?>

  • Check that the redirect is working. Type in the old URL into your browser to make sure it redirects to the new page. If not, hit refresh. If that still doesn't work, check to makes sure you've removed everything but the PHP redirect script from the page and that the redirect URL is correct.

Tips & Warnings

  • Creating a backup file of your LG phone contacts is necessary if you don't want to lose your information in the flashing process. If you don't use Verizon Wireless's Backup Assistant or your new network doesn't have a mobile backup, you can manually transfer the important numbers in your address book. Write down the information before having the phone flashed, then manually enter it into the LG phone.
  • Although flashing your LG phone to a new network will usually make voice and text features available, features such as MMS may not work. Contact customer service for specific information about your LG phone and its new network features.

References

  • Photo Credit http, www, icon, web, website image by creative from Fotolia.com
Promoted By Zergnet

Comments

You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!