Solved

Protecting certain folder in a virtual host

Posted on 2004-04-14
3
370 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

627 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