Solved

http, https and htpasswd

Posted on 2014-11-18
6
120 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 83

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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

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 83

Expert Comment

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

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

932 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

9 Experts available now in Live!

Get 1:1 Help Now