New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
Web Design and Hosting Creating sites, scripting, and hosting discussions.

OS 10.4 - Better URLs for Sites hosted on OSX?


Post Reply New Thread Subscribe

 
Thread Tools
nickyg622

 
Member Since: Jan 24, 2007
Posts: 2
nickyg622 is on a distinguished road

nickyg622 is offline
Hi,

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 http://127.0.0.1/~nick/mysite.com

However, many of the pages in my site rely on URLs relative to the document root, expecting mysite.com 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,
Nick
QUOTE Thanks
mac57

 
mac57's Avatar
 
Member Since: Apr 29, 2006
Location: St. Somewhere
Posts: 4,560
mac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant futuremac57 has a brilliant future
Mac Specs: iMac 27" 3.4 GHz, 256 GB SSD, 2 TB HDD, 8 GB RAM

mac57 is offline
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
QUOTE Thanks
nickyg622

 
Member Since: Jan 24, 2007
Posts: 2
nickyg622 is on a distinguished road

nickyg622 is offline
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?
QUOTE Thanks

Post Reply New Thread Subscribe


« Free site.. | Problem viewing my website »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
MS contingency to buy OSX mass licence Smartz Apple Rumors and Reports 16 03-28-2006 01:40 PM
HELP!! Installing OSX was tough, But NOW I'm hosed Aloel OS X - Operating System 8 04-23-2005 07:13 PM
Broken Disk Drive but Want to Upgrade to OSX...Impossible? mariamarchita OS X - Operating System 3 02-27-2005 01:52 PM
printing PostScript with OSX davidp158 OS X - Operating System 9 02-09-2005 08:56 PM

All times are GMT -4. The time now is 06:57 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?