1. ## Apache directories

Hey,
How can I set-up Apache to have something like a virtual directory? Like http://localhost/clanmod
is really D:\gamezone\Half-Life\cstrike\addons\clanmod but my DocumentRoot is C:\www\root.

Anyone know how to do this?

Thanks

2. Hi,
this is a question about Apache only,
so next time please put it into the brand new forum "Configuring Apache"...check my sig!

Well,
just because you are here let me examine your question

http://httpd.apache.org/docs/urlmapping.html#outside

So you could do:

Please note that the Alias directive cannot be put inside .htaccess,
http://httpd.apache.org/docs/mod/mod_alias.html#alias

http://httpd.apache.org/docs/urlmapping.html#outside

I tested on my pc locally and it works...

pippo

3. Thanks for that, I would have posted in the Apache forum but I didn't know it existed

While it's here though, do you know if I can make it so outside users can't use it? Like I want to edit some files in the directory with a PHP script but I don't want outside users to have access to it.

Any ideas on this?

Thanks

4. It's not clear to me what you exactly want to do,
but with php it's possible for you to access files outside the Apache Document Root ( if you have the right permissions to do that ).

>>do you know if I can make it so outside
>>users can't use it? Like I want to edit
>>some files in the directory with a PHP
>>script but I don't want outside users
Not sure this is what you want,
but for example you could do:

.htaccess
Code:
<FilesMatch "\.inc$"> order allow,deny deny from all </FilesMatch> This will prevent file with .inc extension for being viewed externally. But inside your scripts you can always do: PHP Code:  include 'myfile.inc'; //etc  For the same concept it's possible to deny accesses to a directory from "outside" such as: /clanmod/.htaccess Code: order allow,deny deny from all but from your scripts you can: /myfile.php PHP Code:  include "clanmod/somefile.someext" //or$fp = fopen( "clanmod/somefile.someext", "w" ); //put some info inside the file fclose( \$fp ); // // Typing somesite.com/clanmod/somefile.someext // will produce a Forbidden error //  
So basically it's possible to access the directory clanmod from your scripts but not from the web (browser).

As you can see, there are many things that you can do.
I have not take in consideration using rewrite rules,
which are my favourites and that I love shameless, because most often people do no have access to them .

If you are more specific (for me at least ), it could be possible to give a more specific and well dedicated answer for your needs.

Hope This Helps!

pippo

5. Ta, but after changing my mind I've decided that I don't want to block access.

Thanks for your help on this

6. DJ, good job using clanmod, clanmod rocks
I am a.k.a. Harlaugur, CM team

7. And now I have a question for u pippo, about locking directorys.

ok, now how do i access a directory on my webserver, say i host my website in
C:\wwwroot\
C:\wwwroot\dl\
but when i go in there there comes this error

Forbidden
You don't have permission to access /dl/ on this server.

--------------------------------------------------------------------------------

Apache/2.0.43 Server at localhost Port 80
And sice i am the web server i should be able to control it. From another thread i read i should use .htaccess but in the manual says this

In general, you should never use .htaccess files unless you don't have access to the main server configuration file.
So I was wondering, how would i set it so all users can view this folders items and dl them, also, could I just allow some users to access this directory

A answear would be very helpful!

8. You can use a .htaccess file to control who has access to it but I'm not sure how you would let users browse the directory

Good luck though

PS. ClanMod rocks

9. If you want only some people to be able to access a particular directory I would suggest to use user authentication:
http://httpd.apache.org/docs-2.0/howto/auth.html

So,
httpd.conf
Code:
<Directory "c:\wwwroot\dl">
AuthType Basic
AuthName "Restricted DL Area"
require valid-user
</Directory>
I put "require valid-user" instead of "require user pippo paperino" because when you'll add a new user you'll have to change httpd.conf and so you'll have to reboot the http server.
http://httpd.apache.org/docs-2.0/mod/core.html#require

It's possible to create an .htaccess file inside the directory c:\wwwroot\dl too.

I would keep the password file outside the document root.

pippo is an user name...

That command creates the file too.

http://httpd.apache.org/docs-2.0/programs/htpasswd.html

So when an user will want to access yoursite.somewhere/dl directory he will be prompted to insert user+password.

It's possible to restrict accesses to people by their ip too.
The link I provided take in consideration that too and more...

Typically before posting something I test it,
actually I can't.

pippo

p.s.
there are some considerations to do.

Preamble)
The advice of the manual is right...obviously!

1st)
Perfomance,
putting directives inside httpd.conf is a bit faster.
For example on an server I owned I disabled apache to look at .htaccess.
I do not know how faster in terms of time it is,
I admit it's a concept that one day or another I will check in deep.

2nd)
Not all directives can be put inside .htaccess.

3rd)
Changes to the httpd.conf require you to restart the http server.

4th)
that's why most example refer to it only.

5th)
Independently by the fact of the perfomance it's right to use .htaccess in some circumstance,
even if you could modify httpd.conf.
By using .htaccess it's more easy to maintain your website,
you do not need to restart the server.

6th)
.htaccess permit end-user configurations.

7th)
Last but not least,
these are my humble thoughts only....

10. ok i got it I think, apache dosn't start up right now but i know what to do
1 thing, htpasswd, how the f*** does it work, ok I have some lines of some sorce stuff but how accually does it work, do I make a shortcut and add stuff to the command line or do I just double click it and then it comes (didn't work) or just what?