SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    Hull, UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    site root relative links and IIS

    Hi guys,

    I'm developing a site locally and uploading it to IIS on my own computer (running WinXP). The site is in a local root folder called 'website', and I'm uploading the whole site so that the path is C:\Inetpub\wwwroot\website\

    I'm accessing the pages in the browser at the following URL:

    http://localhost/website/

    so, for example, the home page is located at:

    http://localhost/website/index.php


    I'm happy to use document relative links where I can, but 2 instances where I can't are in my stylesheet (I have an image or 2 in there that need to have site root relative paths as the html files could be buried within several subfolders) and in server-side includes (for basically the same reasons).

    I'm sure this is a no-brainer but any links referenced as relative to the site root don't show up. I'm pretty sure that when I upload to a remote server it'll be fine, but I need to show people how the site is coming along on a local machine before uploading. Is it because my site is contained within the 'website' folder in wwwroot??

    Any help on how to do this or how to workaround it would be very much appreciated indeed. Thanks!

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes. That's exactly why.

    You can create a new website. In IIS go Actions --> New --> Web Site and make that site's home directory the site directory.

    Web site's home directory = C:\Inetpub\wwwroot\website\

    Let's say you call the site "website". URL will be http://website/

    G

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    Hull, UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply Greg, I'm still struggling a bit though, sorry to be a nuisance - I've opened IIS, but the Action menu doesn't give me the option of 'New' unless I've clicked on 'Default Website', in the 'Web sites' folder (in the left-hand explorer pane). I tried creating a new virtual directory (the only relevant option I could see) but putting the site there still caused the same problem with site root relative links. The new site was still within the Default Web Site list. I know the answer will be blindingly obvious...

    My current root folder ('website') is within 'Default Web Site' at the moment. I just can't figure out how to create a new site separate to the default, if you see what I mean(??) Any more would be really appreciated, thanks!

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Multiple websites are only an option for the server version of IIS. It is not an option on the version IIS that runs on Win2000 or XP Pro.

    WWB

  5. #5
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    Hull, UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, I thought as much. Do I have any other options then, re: my original question? How can I view site root relative links via IIS on my local machine without having to upload the site to a remote server?

  6. #6
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    Hull, UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Update: I figured out that some of my problems lay in my php requires, and fixed them by changing the path from

    <? require ("/includes/header.php") ?>

    to

    <? require ($_SERVER['DOCUMENT_ROOT'].'/includes/header.php'); ?>

    I also moved all my files directly into wwwroot so the root relative links now work.

    But still, I have a few sites on the go and really need to have folders within wwwroot that serve as root folders for the respective websites.

    Any ideas on how to go about this in IIS (WinXP - not full server edition)? Thanks a lot!

  7. #7
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    Hull, UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just musing to myself here: found one or two fixes here and there, this one especially stands out tho not tried it yet -

    http://www.hairy-spider.com/multisite.aspx

    However, may just install Apache instead (issue with Zone Alarm worries me tho...)

    Does anyone know of a way I could implement a redirect in PHP in IIS instead?

  8. #8
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    Hull, UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Last thing to ask, wondering if anyone can help me:

    although the version of IIS that comes with WinXP only allows for one 'website', it appears to allow for more than one virtual directory.

    So, seeing as I only need IIS to view pages and scripts locally, is that the answer to my question? It appears to work!

    Cheers guys

  9. #9
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there. Sorry about the server edition thing. I didn't realise there were exceptions. Always had the full thing myself.

  10. #10
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    Hull, UK
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem at all Greg, I decided to get apache anyway in the end.

    Thanks for the reply


Bookmarks

Posting Permissions

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