Jump to content

[SOLVED] Creating virtual directories, where to set it up


jordanwb

Recommended Posts

I have XAMPP installed on my Vista computer. I want E:\xampp\htdocs\jukebox\songs to point to E:\Music, I found this topic: http://www.phpfreaks.com/forums/index.php/topic,105954.0.html and this page: http://httpd.apache.org/docs/1.3/mod/mod_alias.html They're both useful (more the later than the former) but I'm kinda confused where and how I'm supposed to put this in. Do I put it in a .htaccess file or in php.ini?

 

BTW where did the "Topic Solved" button go?

 

Thanks.

Link to comment
Share on other sites

I found out that I need to put

 

Alias /jukebox/songs "E:/Music" into Apache's httpd.conf file but I get an HTTP 403 error. I know I'm supposed to put a <Directory "E:/Music"> after but I don't know what to put there.

Link to comment
Share on other sites

I figured it out. (Sorry for triple posting but I couldn't edit)

 

For those that need help on a similar subject:

 

1: Open Apache's config file (%XAMPP_ROOT_FOLDER%\apache\httpd.conf using Notepad or whatever

2: At the end of the file add the following:

 

Alias *path to virtual dir* *path to real dir*
<Directory *path to real dir*>
Options +Indexes
Order allow,deny
Allow from all
</Directory>

 

This is a real example that I'm using:

 

Alias /jukebox/songs "E:/Music"
<Directory "E:/Music">
Options +Indexes
Order allow,deny
Allow from all
</Directory>

Make sure that the paths don't have a trailing slash. Save the httpd.conf file and restart Apache

Link to comment
Share on other sites

virtual hosting will allow  you to create a local domain name for any directory on your hard drive.

therefore, after you create it it can be accessed via your browser using the domain name  you choose.

so that if you wanted to have pages served from e:\music you can.

you could call it local.music.com or whatever

1) on a windows machine you need to set up the etc/hosts file found in

system32/drivers/etc/hosts

it might end up like this:

127.0.0.1      localhost

127.0.0.1      local.music.com # for browser access

 

if you choose to call it that ( local.music.com) or anything you want. just make it different

from any real web server so you know where you are...

 

then you need to configure apache to know how to serve the pages...

with xampp you are given a  lot of config files, the one  you need is called extra.httpd-vhosts.conf

under the apache/conf files.

it might end up looking a bit like this:

 

<VirtualHost *:80>

DocumentRoot E:\music

ServerName local.music.com

<Directory E:\music>

Options Indexes FollowSymLinks +Includes

AllowOverride All

Order allow,deny

Allow from all

</Directory>

</VirtualHost>

 

 

then restart the apache serve, but likely you will also need to reboot

so that the etc hosts file is reread.

let me know how that goes...

at that point you should be able to url the site from you browser

by pointing it to : http://local.music.com

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.