.htaccess tutorial

htaccess Elite


protect all but one - when user type just domain name

Security in htaccess: htpasswd, 401 Authentication

protect all but one - when user type just domain name

Postby pawcio » 11 Sep 2008 15:10

Hello everyone!

Here's what I want in few simple steps.

1) I am developing a site and I do not want anyone to see it - that is why I have secured it with a password using htaccess.

2). I created a welcome screen' - single page with 'cooming soon' etc. and I want only this page to be available to everyone - I managed to get this working as well.

3). Name of this page is index.html and I want it to display when
someone visit my site.

this is how my .htaccess looks like now:

Code: Select all
   <Directory "/var/www/vhosts/mydomain.com/httpdocs">
      <Files index.html>
      order allow,deny
      allow from all
      Satisfy Any
      </Files>
      
      AuthType Basic
      AuthName " "
      AuthUserFile /var/www/vhosts/mydomain.com/pd/pwd
      require  valid-user
   </Directory>



At the moment, when one type http://www.mydomain.com/index.html -> the page is displayed to the user and it does not ask for password (exactly as I wanted). BUT - when one type http://www.domain.com - then it asks for the password.

I though that when you type just the domain name, the directory index is displayed - index.html in this case - index.html is not password protected so why it keeps asking for password?

Basically, I want both http://www.mydomain.com and http://www.mydomain.com/index.html to be unprotected (and other files and directories protected).

How I can achieve this?
Many thanks!
pawcio
 
Posts: 1
Joined: 11 Sep 2008 14:54

Return to Security and Authentication