• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Web Site Explicit/Relational Links

RSLancastr

www.StopSylvia.com
Joined
Sep 7, 2001
Messages
17,135
Location
Salem, Oregon
All:

When developing a web site on my home PC, I have always avoided the problem of linking to other pages within the site by using "relational" URLs.

For instance, I have a site where there is a /contacts folder and a /home folder (both in the root). Each has its own index.htm, and each links to the other.

If the link in /Contacts/index.htm reads <A HREF="/home/index.htm">, it will work once on the site's server, but not while it is on my PC (unless I create the site in a drive's root directory - ick).

I have gotten around this in the past by using "relational" links such as <A HREF="../home/index.htm">, which works both on the server, and in whatever folder on my PCI choose to create the web site.

Now that I am delving into the world of CSS, I'm finding that explicit (rather than relational) URLs and URIs are recommended, partly because some browsers incorrectly implement the standard, so some look for the file in relation to the folder with the HTML, others in relation to the folder with the CSS.

So, what is the best way to fool my PC into looking at a specific folder as the root of a drive? It's a standalone PC, so I can't seem to use the Map Network Drive, the only solution which occured to me offhand.

Do I need to install a web server on my PC?

Thanks for any and all suggestions.
 
I would certainly recommend installing a web server for testing purposes anyway. Apache is 5 minutes' work to set up, and really helps you see how things will look when online. Xampp makes things even easier if you're short on time, though some will say it's a security risk.

Cheers,
Rat.
 
I typically use relative links with CSS and haven't run into problems. Are you sure they aren't talking about the including of the CSS file itself rather than links within the HTML?
 
I second the suggestion to test your site using Xammp.

Just make sure you are using a machine that can't be reached from outside your network.
 
I would certainly recommend installing a web server for testing purposes anyway. Apache is 5 minutes' work to set up, and really helps you see how things will look when online.
Thanks, I'll look into that.

Webservers have the conecpt of a root folder (eg mine is called webroot) and all file URLs can be specified in terms of that. You using Meyer for CSS?
Thanks. Yes, I have three O'Reilly CSS books: Meyers' CSS The Definitive Guide and CSS Pocket Reference, and Schmidt's CSS Cookbook. As with all O'Reilly books I've read, they deliver the goods.

I typically use relative links with CSS and haven't run into problems. Are you sure they aren't talking about the including of the CSS file itself rather than links within the HTML?
According to Meyers, the standard is that relative URIs (such as for images) within a CSS should be relative to the folder containing the CSS document, but that some versions of some browsers (I believe Navigator was mentioned) instead attempt to find the file relative to the folder containing the HTML/XHTML document.

If you keep both in the same folder, or never use those flawed browsers, this shouldn't be an issue.

I second the suggestion to test your site using Xammp.

Just make sure you are using a machine that can't be reached from outside your network.
I have a (software) hardwall running. Perhaps after I install a router instead... Thanks!
 

Back
Top Bottom