How to add virtual directory

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
weixin268
Forum Newbie
Posts: 15
Joined: Mon Feb 17, 2014 12:53 am

How to add virtual directory

Post by weixin268 »

Hello!

Using Linux or Apache, if the web root is at d:\web, how to add virtual directory like IIS, e.g. add d:\share as a virtual directory.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to add virtual directory

Post by requinix »

I think what you're looking for is Alias.

Code: Select all

Alias /share D:\share
<Directory D:\share>
    Order allow,deny
    Allow from all
</Directory>
weixin268
Forum Newbie
Posts: 15
Joined: Mon Feb 17, 2014 12:53 am

Re: How to add virtual directory

Post by weixin268 »

Hello!

This is not php format, right?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to add virtual directory

Post by requinix »

Right. It's better to let Apache do it than PHP.
weixin268
Forum Newbie
Posts: 15
Joined: Mon Feb 17, 2014 12:53 am

Re: How to add virtual directory

Post by weixin268 »

Hello!

Tried to add virtual directory into the section of Aliases, but without functioning. Any body can help? Thanks!

Server: Buffalo LinkStation

1. edited httpd.conf at /etc/apache

2. Add virtual directory at the section of <IfModule mod_alias.c>

Alias /share "/mnt/disk1/Share"
<Directory "/mnt/disk1/Share">
Options None
AllowOverride All
Order allow,deny
Allow from all
</Directory>

3. then performed apache restart

4. try to open http://192.168.0.100:81/share/test.htm
it's 404 - Not Found
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to add virtual directory

Post by requinix »

It looks right. What if you have Options +Indexes and go to just /share?
Post Reply