Solved

http, https and htpasswd

Posted on 2014-11-18
6
121 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Service "nameserver" appears to be down 4 588
Problem with .htaccess file 4 70
Issues installing SSL certificate into Apache Tomcat 3 96
Apache / XAMPP  authorisation 10 56
In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
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 …

777 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