Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-07-2004, 05:13 AM   #1
LQ Newbie
Registered: May 2004
Posts: 10

Rep: Reputation: 0
Question Force https on a password protected directory

Hi Gurus,

I would like to setup a directory on my site, where the users would have to login with a password as well as use https only.
This is what I have done so far:

<Directory "/usr/local/apache2/htdocs/secure">
  RewriteEngine  on
  RewriteCond %{SERVER_PORT} !^443$
  RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  AuthType  Basic
  AuthName  "Restricted"
  AuthUserFile  /usr/local/apache2/passwd/passwords
  Require  valid-user
This seems to do the job with one big problem: it asks for the password twice (one for the original http and then one for the https I guess).
What am I doing wrong here? Any help is much appreciated.
Old 06-07-2004, 05:35 AM   #2
Registered: Apr 2004
Location: ..where no life dwells..
Distribution: RH,FC/SuSE/Debian/HPUX/OSX
Posts: 518

Rep: Reputation: 30

I think i had the same prob on my old RH9-box one year ago.

an alternative is using a php-script like this instead of a link:

header ('Pragma: no-cache');
header("Location: https://host.domain.tld");

at the moment i dont know, but when im at home ill try and come back...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Protected Folder's vezril Linux - Security 2 06-07-2005 12:26 AM
Password protected Apache ne21 Linux - Software 5 07-30-2004 02:08 AM
password protected directories dsgdevil Linux - General 1 02-17-2003 01:02 AM
Password Protected Directories TheSockMonster Linux - Security 2 05-31-2002 05:07 PM
Password protected entries HHH Linux - General 3 06-27-2001 11:13 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:10 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration