PDA

Click to See Complete Forum and Search --> : Setting the root directory


joshil3
03-05-2007, 01:03 PM
Hey everyone, I've got a bit of a relative path setting problem. I want to use relative paths from the root for my site because I would like to use a SSI for my navigation bar which will be placed on pages in multiple directories. Everything works great on the server when I start my URLs as "/index.html" or "/contact/contactform.html" and same for "/stylesheets/stylesheet.css"

My problem is that this doesn't work on my home PC when I am testing the pages before uploading them. They look like they are completely confused :D. I don't use a WYSIWYG editor, although I do have GoLive. I tried setting up a test site through that and I'm not sure what they do to set the root directory.

So right now I have my site in a folder on my desktop "C:\Documents and Settings\Owner\Desktop\Websites\MySite" and would like to make the MySite directory the root directory. I've been googling this for a while now and just get a bunch of asp mumbo jumbo. Any help would be much appreciated, I'm sure this is such an easy fix and you're all laughing at me :o

chris_bcn
03-05-2007, 02:43 PM
if you're using SSIs you won't be able to test locally unless you set up IIS or Apache on your local machine - they are Sever Side includes, and so won't be parsed until they've run through a server.

I'd recommend setting up apache php and MySQL on your home machine - that way you can test away to your hearts content.

If you're using windows you can get the Apache MSI installer here - http://httpd.apache.org/download.cgi

I'll try to find some instructions

joshil3
03-05-2007, 02:52 PM
Thanks Chris. So far I haven't set up my SSI, so I'm still using the original HTML on my PC and it's still on the actual page. That's why I needed to set the root folder on my PC for now.

I was just wondering how to do this so that I can still test my links locally by leaving them in the page while it's on my own PC, and then after I upload them I would just migrate that part of the HTML to an SSI.

I'll take a look at the links you provided, that sounds like the proper way to do it.

chris_bcn
03-05-2007, 02:59 PM
in that case - don't use site relative paths, use document relative. In fact you could use a <base href="http://www.yoursite.com" /> and have all the links document relative, then when you upload the site they'll all be site relative. If that makes sense - it's very ear;y here and I aven't had coffee yet

Benjamin
03-05-2007, 04:25 PM
That's a good tip, Chris.

If you put <base href="http://www.yoursite.com/" /> in the <head> of the page, you can then make all the links relative to that.

Then when you are running the site locally, you only need to change that 1 line of code:

<base href="C:\Documents and Settings\Owner\Desktop\Websites\MySite\" />

I think that should work?

joshil3
03-05-2007, 05:18 PM
Thanks guys! That's exactly what I was looking for!

joshil3
03-06-2007, 04:06 PM
Well I went and read the php includes thread, so now I'm hooked on that instead of SSI. I went ahead and installed WAMP and it is working amazing! I highly recommend it, but then again, I'm a noob :D