Redirects
A redirect automatically takes a visitor at your Web site from an old or deleted page to a new page. Why would you want to create a redirect? Let's suppose you want to change the name of a page within your Web site (and delete the old page). If someone has bookmarked the old page, then they will receive an error message, such as "An Error has Occurred! URL not found". This isn't a friendly thing to do to the loyal customers of your site. If any other sites have links into the old pages in your site, those links will also be broken. It is much better etiquette to create a redirect. There are several different ways of accomplishing a redirect. The two types addressed in this documentation are:
Using Dreamweaver to create a refresh-style redirect To create a redirect in Dreamweaver, perform the following steps: 1. Rename your file in Dreamweaver. Dreamweaver will scan your other pages, and fix any references to the "old" file. 2. Open the now-renamed page (i.e. the "new" page), and choose "File - Save as..." to the "old" file name. 3. At this point it is really easy to get confused, so close all of the open windows EXCEPT for the Site Editor. 4. Open the "old" file. Select the entire contents of the document and delete them. 5. You will now create the redirect, so that if someone visits the "old" page they will be sent to the "new" page. You will start by choosing "View - Head Content" from the main menu bar. This will create a separate space at the top of the document where you can see a graphical representation of what is in the <HEAD> tag of the html document. 6. On the main menu bar, choose "Insert - Head - Refresh". 7. In the dialog box supplied, choose the URL radio button. Fill in the URL for the "new" page. Set the delay to zero. 8. The steps you have completed so far will take care of the technical aspect of the redirect. You should now leave a courtesy message on the "old" page. The following is an example:
9. Save everything, and upload the new page, old page, and any pages that link to the new page. This can be a lot of uploading. Creating a refresh-style redirect in raw html Assuming that you have already created the "new" html page that you want people to be redirected to, in the <HEAD> section of the "old" document, you will want to insert the following code:
where class_wsd.html is the name of the file you want people to be redirected to. You may change the number of second before the refresh begins. The number in RED below controls this:
You can also change the filename/URL that will load. Again, it's in RED.
Note that the content attribute has an unusual format. It has a double-quoted string argument, which is normal, but the contents of that argument are very exacting. The semicolon is required, and there's a sub-attribute URL=
At this point, you should replace the body of the old page with a courtesy note with text similar to the following:
In the following example, user mst3k wants to create a redirect so that when someone visits:
he or she is automatically redirected to:
To create a .htaccess redirect, perform the following steps: 1. Establish a telnet session to the machine where the page you want to redirect resides. For personal home pages hosted on www.people.virginia.edu, establish a telnet session to blue.unix.virginia.edu. If Umenu starts, choose "Option 9: Go to UNIX" so that you see a prompt similar to the following: node13: /home/mst3k $ 2. Change to the directory where the page you want to redirect resides. For example, mst3k would issue the following command (in red): node13: /home/mst3k $ cd public_html The command line will change to reflect the current directory: node13: /home/mst3k/public_html $ 3. Use an editor, such as pico, to create a file called .htaccess (yes, that is a dot before the letter "h"). For example, mst3k would issue the following command: node13: /home/mst3k/public_html $ pico .htaccess The editor pico will then open. User mst3k would then enter the following line into the file: Redirect /~mst3k/oldpage.html /~mst3k/newpage.html Note that there are spaces between the three parts of the command: 1. the word "redirect"; 2. the filepath of the old page; 3. the filepath of the new page. 4. Save the file and exit pico (CTRL-X, Y, Enter) After you have uploaded the altered pages, you should test your redirect. Open a Web browser of your choice and surf to the "old" page. If all goes well, you will notice a short delay, and then the browser will refresh to the "new" page.
Web
Development Support | General
Info | Getting Started
| Design & Promotion If you need further assistance with Web applications or questions, send e-mail to web-consult@virginia.edu or call the ITC Help Desk at 924-3731. |
|||||||||||||||||||||||||||||||||