.htaccess question

SiDiuS

Weaksauce
Joined
Mar 6, 2003
Messages
120
Okay I'm simply just trying to make it so the when you log on to www.mysite.com. The first page you see is your "index.htm" file. I want to password protect that page and then when you put the username and password in it redirects you to "home2.htm"

Here's the code I have for the .htaccess file

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /public_html/downloads/.htpasswd/.htpasswd
AuthGroupFile /dev/null
<Files home2.htm>
require valid-user
</Files>

I put that file into the "public_html" folder

Then I uploaded the .htpasswd file into a different directory called "downloads" inside the "public_html" folder. which I used a username and password generator for which looked something like this

kajuser1:.6Rpf5jCn6vR6
kajuser2:e0tmkhlP9Gwvs
kajuser3:XhFe0aClGwu32


When I go to the site nothing happens, no pop up box at all. Am I doing something wrong? Any help would be much appreciated
 

MadJuggla9

2[H]4U
Joined
Oct 9, 2002
Messages
3,515
Too bad you don't run your own server, you can control that directly from the apache config file. Maybe you should contact your host, if they allow it, then they would/should have no problem helping you.
 

Frobozz

[H]ard|Gawd
Joined
Feb 15, 2002
Messages
1,817
Take a look at the Apache docs on Authentication.

This is completely dependant of how your host's apache is configured. If they allow you to override authentication from .htaccess then you should just need to make your .htaccess similar to this and place it in the directory you want to protect.

Code:
AuthType Basic
AuthName "Authorized users only"
AuthUserFile /home/SiDiuS/Documents/password.file
require valid-user

A big thing I would suggest would be to put your password file in a directory that is not accessible from the web. (outside of public_html)

If you want to put up a greeting page, then I would just move the contents of your site (& .htaccess) to a lower level directory and have a page that does a redirect (meta-refresh or just a hyperlink) on the root of your site.
 
Top