Solved

Protecting certain folder in a virtual host

Posted on 2004-04-14
3
367 Views
Last Modified: 2013-11-18
I run an apache web server, utilizing named virtual  host.
I want to password protect a subfolder in the virtual host, for example this folder :

http://www.mydomain.com/tmp/

I know that I should use .htacess, but how to put this into httpd.conf ?

Here is part of my httpd.conf configuration:

DocumentRoot "/var/www/html"

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

<Directory "/var/www/html">

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny
    Allow from all

</Directory>

<VirtualHost *:80>
    ServerAdmin webmaster@mydomain.com
    DocumentRoot /home/www/mydomain.com/html/
    ScriptAlias /cgi-bin/ /home/www/mydomain.com/cgi-bin/
    ServerName mars.mydomain.com
    ErrorLog /home/www/mydomain.com/logs/mydomain.com-error_log
    CustomLog /home/www/mydomain.com/logs/mydomain.com-access_log common
    CustomLog /home/www/mydomain.com/logs/mydomain.com-deflate_log deflate
</VirtualHost>
0
Comment
Question by:kapot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
shaggyb earned 160 total points
ID: 10821604
first youll need this in the first part of the config

<Directory "path to the root of your web page">

    Options Indexes FollowSymLinks


    AllowOverride authConfig   <------------------ need that....this lets you override to allow access to lower directorys  or ask for passwords  what ever


    Order allow,deny
    Allow from all
</Directory>



then

AccessFileName .htaccess

then

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>

to hide the .htaccess file in the given directory if you have indexing on



then


Alias /youralias in your expaple avoe this would be tmp "path to the directory you want to be tmp localy on your hdd example c:/windws"

<Directory "path to your dir same as what is in the quiote above">

    Options Indexes MultiViews FollowSymLinks  <-------------- the indexes is only if you want someone to be able to see the idiviual files
    AllowOverride AuthConfig     <----------- make apache look for the htaccess file
    Order allow,deny
    Allow from all

</Directory>

0
 
LVL 3

Expert Comment

by:shaggyb
ID: 10821608
damn...sorry for the typos     i need to goto sleep
0
 
LVL 15

Expert Comment

by:samri
ID: 10822983
hi Kapot,

Shaggyb is pretty much on the track.

For more information, you may want to jump to Apache website for some information, and HOWTO on how to get that achived.

http://httpd.apache.org/docs-2.0/howto/auth.html
http://httpd.apache.org/docs-2.0/howto/htaccess.html

Hope this would help.

cheers
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question