Results 1 to 3 of 3
  1. #1

    Member Since
    Jan 24, 2007
    Better URLs for Sites hosted on OSX?

    I'm attempting to host a site on my machine while I work on it, but I'm running into (what I hope is a small) problem:

    My site lives in my Sites directory, so the url is

    However, many of the pages in my site rely on URLs relative to the document root, expecting to be the root. So, when I load up my site, all of my links and images break.

    I've done a bunch of searching, but I can't seem to find the way to fix this. Can anyone offer any suggestions?

    Many Thanks,

  2. #2

    mac57's Avatar
    Member Since
    Apr 29, 2006
    St. Somewhere
    iMac 27" 3.4 GHz, 256 GB SSD, 2 TB HDD, 8 GB RAM
    I have done something like this with my site, which I developed in my Sites folder hierarchy, but then uploaded to the web hosting company I use.

    Let assume the following hypothetical site layout

    Main Page with two subpages, SubPage 1 and SubPage 2, both one level down from the Main Page

    I have references in SubPage 1 to things in SubPage 2, and references in both to the main page. To make this completely portable, I have used relative paths.

    So, for example, if I have a link in SubPage 1 called "SubPage2" that takes you to SubPage 2, the form of that link would be:

    <a href="../SubPage2/subpage2.html">SubPage2</a>

    In this way, all references are relative to the current position vs being absolute paths.

    Does this help or have I missed your issue completely?
    My Macs: iMac 27" 3.4 GHz, Mac Pro 3.2 GHz, PowerMac G5 Quad 2.5 GHz, G4 Cube with 1.2 GHz Upgrade
    My iStuff: 64GB iPhone 5, 64GB iPad4, 30GB iPod Video, 16GB iPod Touch
    My OS': Mac OS X Lion, Mac OS X Snow Leopard, Mac OS X Tiger, Mac OS 9.2.2, openSUSE 10.3
    I was on the Mac-Forums honor roll for September 2007

  3. #3

    Member Since
    Jan 24, 2007
    Thanks for your reply.

    That helps, but doesn't quite solve my problem. The issue is that I need to be able to transfer files between my dev site on my computer and the live site, so the links need to work for both. Certain links in the templates (like stylesheet links and images in the header and footer) need to work from different points in the hierarchy, so relative paths won't work.

    I imagine there's a way to do something with the Apache settings to basically clone a folder in the Sites directory as a root level folder (perhaps using symlinks, the hosts file, or .htaccess), but I haven't figured out how yet.

    Any other suggestions?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to Create Shorter URLs with your iWeb/MobileMe sites!
    By heidismiles in forum Web Design and Hosting
    Replies: 6
    Last Post: 04-29-2009, 12:27 AM
  2. Replies: 3
    Last Post: 09-01-2008, 11:58 PM
  3. Files Hosted on a second server?
    By Kayotic Sully in forum Web Design and Hosting
    Replies: 0
    Last Post: 03-13-2008, 09:37 PM
  4. Hosted Mac desktops
    By hostedmac in forum macOS - Apps and Games
    Replies: 2
    Last Post: 02-09-2008, 08:18 PM
  5. Duplicate threads on different sites? & Information sites
    By PhrogDriver in forum Schweb's Lounge
    Replies: 2
    Last Post: 07-10-2006, 07:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts