Page 1 of 1

site root relative path

Posted: Fri Jan 20, 2006 8:18 pm
by vchris
Hey guys!

I have a site which I will have includes for the header and footer. There will be many levels of folders so the document relative path wouldn't work.

I'm using IIS for my development server. So I have the wwwroot folder in which I have all my websites and stuff... one folder is for that site. If I use this:

Code: Select all

<img src="/images/banner.jpg">
It will not find the banner.jpg image because it's not under the wwwroot folder its under wwwroot/mysite/images/banner.jpg

What I wanna know is, is there a way to change to root directory so I can use /images/image.jpg for my images and includes?

I know on the website server that's not an issue.

Can I configure IIS to change that or is there any other way?

my site is in php btw.

Posted: Fri Jan 20, 2006 9:00 pm
by josh
I think putting this in your <head> does the trick

Code: Select all

<BASE href="http://www.example.com/mysite/">

Posted: Fri Jan 20, 2006 9:12 pm
by vchris
But I'm still on the dev server so I cannot refer to it as a .com or anything u know its http://localhost/mysite/index.php

Posted: Wed Jan 25, 2006 3:54 pm
by vchris
anyone?

Posted: Wed Jan 25, 2006 3:58 pm
by nickman013
try adding the port to localhost...

example

Code: Select all

<BASE href=http://localhost:80>

Re: site root relative path

Posted: Wed Jan 25, 2006 4:27 pm
by raghavan20
vchris wrote:I have a site which I will have includes for the header and footer. There will be many levels of folders so the document relative path wouldn't work.
I am pretty sure that you will be able to refer to any document with relative path, provided the files are in the same drive.

use ../ for moving back
use / for moving forward

Posted: Wed Jan 25, 2006 5:30 pm
by vchris
what if I have a header.php file included in each page.

How would I link to the css file with relative path? The pages are on different levels so ../css/style.css wouldn't work for all pages.

Posted: Wed Jan 25, 2006 5:49 pm
by raghavan20
it seems like you do not want to give specific relative paths for all URLs. 8O

Posted: Wed Jan 25, 2006 7:29 pm
by vchris
No I don't. I want absolute path except on the dev server it won't work.

Re: site root relative path

Posted: Wed Jan 25, 2006 10:08 pm
by nickman013
raghavan20 wrote:
vchris wrote:I have a site which I will have includes for the header and footer. There will be many levels of folders so the document relative path wouldn't work.
I am pretty sure that you will be able to refer to any document with relative path, provided the files are in the same drive.

use ../ for moving back
use / for moving forward
on this, each . [dot] moves back a folder?

Re: site root relative path

Posted: Wed Jan 25, 2006 10:11 pm
by raghavan20
nickman013 wrote:
raghavan20 wrote:
vchris wrote:I have a site which I will have includes for the header and footer. There will be many levels of folders so the document relative path wouldn't work.
I am pretty sure that you will be able to refer to any document with relative path, provided the files are in the same drive.

use ../ for moving back
use / for moving forward
on this, each . [dot] moves back a folder?
no two dots let you move a folder one level down....

If you can remember in Windows cd. is the same folder but cd.. takes you back to the folder one level down

Posted: Wed Jan 25, 2006 10:20 pm
by nickman013
o, ok thanks

if there a way to go back like 3 folders or somthing?

Posted: Thu Jan 26, 2006 4:15 am
by raghavan20
../../../current_directory...as simple as that ...one ../ for going back one level down.

Posted: Thu Jan 26, 2006 7:01 am
by nickman013
cool, thanks alot that really helps me