Electric Type

Multimedia

About Us

News

Help

Redirect or Symbolic Link?

Page 3 — Symbolic Links

If it's too much hassle to set up a redirect, or you want your users to have the illusion they are at an address when they really aren't, you could create a symbolic link - provided you have some basic Unix skills. Using the command ln -s, you can create a symbolic or virtual link to the correct page. This function is also incredibly useful if you have a site where you'd like your readers to use the same simple URL, but g et the most current information. We use this a lot at HotWired. For example, /geektalk/ will always bring you to the most recent Geek Talk.

Here's an example. First, you need to create a directory called june:

    mkdir june

Enter the june directory with a change directory command:

    cd june

Then you can create the link by typing the command ln -s, the full path of the file you want to link to, and then the name of the fake file, like so:

    ln -s /party/june.html myparty.html

Use the command ls -l to see what you've done. It will look something like this:

    lrwxrwxr-x 1 yourname myparty 20 Mar 14 13:05 myparty.html -> /party/june.html

When a visitor requests http://myparty.com/june/myparty.html, she will be sent the information from the file at http://myparty.com/party/june.html instead. When you are creating symbolic links, you should watch for absolute paths in t he HTML and for any additional files (images, sounds, CGIs, etc.) called in by the page - they may be broken from the linked page even though they work fine from the original.

It's also possible to create redirects using CGIs, but I'll leave that story to someone else.


Dynamic HTML  

Frames  

HTML Basics  

Stylesheets  

Tables  

XML  

Javascript  

Database Connections  

Intro To Perl  

HTML 4.0  

User Blogs

Screen Shots

Latest Updates

Contact Us

Valid HTML 4.01!
Valid CSS!

Breadcrumb

© ElectricType
Maintained by My-Hosts.com
Site map | Copyright | Disclaimer
Privacy policy | Acceptable Use Policy
Legal information.