Directory protection under .htaccess

Posted on 2003-02-19
Medium Priority
Last Modified: 2010-04-11
Hi, experts:

I have a domain under a Linux 7.2 Server. I use there that .htaccess/.htpasswd scheme to control access to some directories. It normally works in this way: when I enter the protected directory the first time, it asks the user/password. If I leave the site through the browser's back button and I return by the forward button it doesn't ask the user/password, until I cancel the browser and call it again. If I kill the browser, so when I enter the protected directory again it asks the user/password. That's ok.

But now I realized that, specifically at some computers of my office (and I don't know why), even if I kill the browser, it doesn't ask the user/password when I enter the protected directory again.

Question: Would it be any specific Internet option of the browser? Could it be any option of the .htaccess file. I am using this file set:

AuthType Basic
AuthName "Private access"
AuthUserFile /home/scoposl/www/cgi-scoposl/protect/.htpasswd1
require valid-user

Thanks for any help.

Mario Jorge Lima./
Question by:multisites
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

Accepted Solution

herrmann1001 earned 300 total points
ID: 7981517
definitly a browser problem. Which browser do you use?, (the one with the problems)

It could be so that the browser caches the page, and reads it directly from disc, instead of requesting it again over the network. And thus, it appears that you didnt have to log in.

Best of times!

Expert Comment

ID: 7981613
You need to control caching on the server side, this is not a browser problem. This is done primarily through your web server...or commands in your .htacces file.  For instance with Apache web servers you can includet this command header in htacces

NauAuthBrowserCache enabled

This directive allows you to control client browser page caching behavior and can be set to either "enabled", "disabled", or left out completely. The default (if this directive is not present or is set to something other than a valid keyword) is the same as if you had specified "enabled", which enables normal browser caching. By setting this directive to "disabled" the web developer can force web content protected by their .htaccess file to be "pre-expired". This forces compliant browsers to request a fresh copy of the web pages each time the user tries to view them.


Author Comment

ID: 7982726

What you say really makes sense, but I tried it putting that directive you mention in my .htaccess file and it didn't accept it, for when I access the directory by the browser it returns a Server Internal Error. I don't know if the sintax is right or what should be the position of the directive in the sequence of commands.

I am running under a Linux 7.2 with Apache 1.3.27. I have been searching the Apache organization website, and I didn't find any reference to that directive you mentioned.

Well, anyway, I thank you for help, and if you have any more hint about what I could do, thanks in advance.


Expert Comment

ID: 7992531
otherwise you can use a meta-tagg for the html-files you have under the procetive area.

<META http-equiv="Expires" content="Tue, 20 Aug 1996 14:25:27 GMT">

If you a tag like this in your header, adjust that the expire is set to a date or time before present time.
This will force your browser to get a new copy from the server when you hit the back button.

And Noulette, explain to me how an actual request from an browser goes?.

I say it is like this:
 User input an URL,
 browser analyses URL,
 if exists in browser cache, read from cache,
   if cached page not expired, show page to user.
      request page from server. (via proxy..)
   request page from server.
 show page to user.

If we agree about this, exlain to me how it can be a server side problem then? Besides if browsercache is turn off.

best of times!

Expert Comment

ID: 9816126
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in approximately one week.  I would appreciate any comments by the experts that would help me in making a recommendation.

It is assumed that any participant not responding to this request is no longer interested in its final deposition.

If the asker does not know how to close the question, the options are here:

EE Page Editor

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

With the rising number of cyber attacks in recent years, keeping your personal data safe has become more important than ever. The tips outlined in this article will help you keep your identitfy safe.
The recent Petya-like ransomware attack served a big blow to hundreds of banks, corporations and government offices The Acronis blog takes a closer look at this damaging worm to see what’s behind it – and offers up tips on how you can safeguard your…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

752 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