Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

http, https and htpasswd

Posted on 2014-11-18
6
Medium Priority
?
138 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
[X]
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
  • 4
  • 2
6 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 84

Expert Comment

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

Featured Post

Turn your laptop into a mobile console!

The CV211 Laptop USB Console Adapter provides a direct Laptop-to-Computer connection for fast and easy remote desktop access with no software to install.

Question has a verified solution.

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

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

715 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