I’m trying to figure out a good internal linking system(s) for my websites. I generally use relative links for my “bread crumbs” style links (North America > U.S. > Alaska), but I’ve never really perfected it.
I just discovered site-root relatives links, which look pretty exciting. I tried it on one of my sites, and it appears to work perfectly. However, I was told that they won’t work online. After all, my local site is named “geoworld,” while the online domain is “www.geoworld.org.”
(Below is an example of a site-root relative link used with an image.)
I was advised to use Apache to convert each my sites to virtual hosts. I spent an entire day wrestling with that, but it was a total disaster. But before I abandon this experiment entirely, I wondered if there might be some way to use PHP to make variable links that will work both locally and online.
Here’s a rough idea:
When I preview the page on my computer, the link would translate like this:
And when I view it online, it would look like this:
Does anyone know how I can do this?