Solved

http, https and htpasswd

Posted on 2014-11-18
6
118 Views
Last Modified: 2014-11-18
I want to use htaccess/htpasswd on only one directory and any sub-directories inside that one and on.

html
html/authpages/(bunch of additional directories)

I want to allow anyone to reach html but I only want to allow authenticated https connections into the authpages directory and all sub-directories.

I have been searching the net for the solution but so far, I can only put the htaccess file at the root of the web site and protect the entire site whereas I want to protect only certain subdirectories so thought I would need an htaccess file in which ever subdirs I would want to protect?
0
Comment
Question by:projects
  • 4
  • 2
6 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40451318
No, you can put 'htaccess' in any directory you want on Apache.  What ever you put in it will affect that directory and all the ones below it.  Here is the general info from Apache: http://httpd.apache.org/docs/current/howto/htaccess.html   And this appears to be a good guide to using 'htaccess': http://www.htaccess-guide.com/
0
 

Author Comment

by:projects
ID: 40451456
Don't really need a guide, I've been using it for a while now but putting my htaccess in the directory I want to protect, leaving the ones above it non protected is not working.

I have my .htpasswd file above html/
I have my .htaccess in the html/.htaccess

The above protects the entire site.

Now, I only want to protect
html/authpages/*

so I put my .htaccess file in there, still pointing to the same .htpasswd file and that doesn't seem to work.
0
 

Author Comment

by:projects
ID: 40451460
Hang on... now it seems to be working... Let me do some testing.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:projects
ID: 40451487
Can I put different .htaccess files in different sub-directories also? Each could either point to the same .htpasswd file or to it's own .htpasswd if needed.
0
 

Author Comment

by:projects
ID: 40451500
Yup, I can put .htaccess files pointing either to the same password file or a new one.

All good, thanks for the leads and tips.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40451652
You're welcome, glad to help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now