SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist ashattuc's Avatar
    Join Date
    Aug 2002
    Location
    Boise, Idaho
    Posts
    411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Virtual Directories?

    Dear All,

    Can you create virtual directories on Apache, much like you would on IIS? I am having a hard time figuring out how to test multiple sites using absolute referencing when they have to be folders within localhost, and so can only use absolute referencing if I put the folder's name in the URL.

    Any ideas?

    Thank you,
    Chris
    Chris S.

    Free Web Scripts - Form generators, AJAX tools and more!
    Micro CMS - A totally free AJAX-based, SEO-ed CMS!

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    I don't fully get ya so here goes

    You can create a virtual directory (ie. http://localhost/dir/ goes it D:\www\some_other_doc_root\) with Alias in either .htaccess of httpd.conf.
    Code:
     Alias other_site/ D:\www\other_site_docroot\
    But for simple link issues, try putting this in the head of your documents.
    HTML Code:
     <base href="this_dir/" />
    That should allow you to use absolute paths and it will start looking from the directory you specify in your <base> tag.

  3. #3
    ko pročita magarac :) boccio's Avatar
    Join Date
    Oct 2003
    Location
    belgrade
    Posts
    354
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you mean referencing your site on local disk like www.yoursite.com? if that is so, let me know...
    Vivvo CMS - Web publishing at your fingertips
    Mile voli disko, a ja belo kolumbijsko

  4. #4
    Mal Reynolds Mandibal's Avatar
    Join Date
    Aug 2003
    Location
    Columbus
    Posts
    718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you can. I've just finished doing this on OS X so I know it works fine..however I think the method would be slightly different on a Windows machine. At the most basic it just required adding the appropriate <VirtualHost> entries for each one you wanted but I'm not sure if you would need to do more with windows settings or not...in OS X it was necessary to add netinfo entries as well. I'll probably try it on my windows machine at home after work to see if I can get it working. If no one else posts a solution first I'll let you know what I find.
    Erh

  5. #5
    ko pročita magarac :) boccio's Avatar
    Join Date
    Oct 2003
    Location
    belgrade
    Posts
    354
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, one more step is needed for windows machine... you have to make entry in hosts file, with loopback address (or address of local web server) and name you want to bind to it...
    entry example: 127.0.0.1 www.myhost.com

    hosts file is located (on win2k/xp) in c:\winnt\system32\drivers\etc\

    stay good
    Vivvo CMS - Web publishing at your fingertips
    Mile voli disko, a ja belo kolumbijsko

  6. #6
    SitePoint Evangelist ashattuc's Avatar
    Join Date
    Aug 2002
    Location
    Boise, Idaho
    Posts
    411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks DJ Pacman, Mandibal and Boccio,

    I tried a couple different things, starting with creating an "alias" in the Apache config file. If you do that, there is still a problem with absolute referencing because an a href like "/images/image.jpb" is going to resolve back to localhost, and not your alias. But, I can see that would be handy.

    Setting up a VirtualHost was more what I was looking for, although realizing I could test on www.mywebsite.com on my local machine was an added bonus. I then created two "host" files in the windows directory, and created two .bat files to switch them, depending on weather I wanted to test on my local machine or be connected to the remote address.

    Thanks for the help folks,
    Chris
    Chris S.

    Free Web Scripts - Form generators, AJAX tools and more!
    Micro CMS - A totally free AJAX-based, SEO-ed CMS!


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
  •