Important Notice: The site is currently being upgraded to a new software system. This process could take a day or two to complete. During that time, we are going to leave the site up here, on its old software. WHAT GETS POSTED HERE DURING THIS TRANSITION WILL NOT BE COPIED OVER ONTO THE NEW SITE, WHEN THE UPGRADE IS COMPLETE. When we swap over, the content posted while this message is visible will be lost. We wanted to give you folks a place to hang out and talk while we worked though. We will let you know when we are finished. Please pardon the inconvenience, during this transition.

Home Forums Classifieds GT Store Blogs Today's Posts Search Social Groups


Glock Talk
Welcome To The Glock Talk Forums.

Thread Tools Display Modes
Old 09-25-2009, 07:26   #1
Senior Member
Toyman's Avatar
Join Date: May 2003
Location: West Michigan
Posts: 3,880
Web Server .htaccess files

Anyone here experienced with .htaccess files?

I've got it working with an .htaccess file in each directory, but now they want to protect files in a sub folder using just the .htaccess file in the root of the web server.

I think I need to use the DIRECTORY directive along with the FILES directive, but I can't seem to get it to work.

I can provide more details if there's someone really good at this.
Mike - A forum post should be like a skirt. Long enough to cover the subject material, but short enough to keep things interesting.
"It's not about the odds, it's about the stakes." -
To view links or images in signatures your post count must be 10 or greater. You currently have 0 signatures.
Toyman is offline   Reply With Quote
Old 09-25-2009, 10:53   #2
flyguy79's Avatar
Join Date: Aug 2009
Location: Mansfield, TX
Posts: 28
Apache? If so, what version?

DIRECTORY directives don't work in .htaccess files - they have to go in httpd.conf or a virtual host block. The FILES directive will work in .htaccess, but you may want to go with a LOCATION directive, which matches URLs instead of file/directory paths.

Edit: scratch that - Location doesn't work in .htaccess either, but FILES does. What are you trying to block?
flyguy79 is offline   Reply With Quote
Old 09-26-2009, 05:57   #3
Senior Member
Join Date: Sep 2006
Location: Virginia
Posts: 1,641
I'm going to assume that "protect files" means you want to restrict folder/file access to certain IP addresses, require a user/password login to access the folder, etc.

.htaccess is a folder specific override. It applies to that folder and all sub folders equally. It was never intended to be placed in the root folder to restrict access only to a specific sub folder one or more levels below. Instead you place the .htaccess file in the folder you want to protect, as you apparently have it now.

If the .htaccess file you have in the root folder basically does what you want, but you have special needs for a particular sub folder under that, you can put another .htaccess file in that sub folder. It can override the rules in the parent/root folder, and either add or remove restrictions for that sub folder.

Putting it in httpd.conf with a directive is the best way to go, and you wouldn't need any .htaccess files in the folders. But if your site is hosted on a virtual server you won't have access to Apache's httpd.conf file, or the ability to re-start Apache to load the edited config file, so using .htaccess files is your only option.

I will gladly help you with it, just PM me. Our company has our own server which I manage, and we host several other business sites on it to help offset the cost of having our own equipment. And since I work from a home office the boss lets me moonlight, so I also take care of another six websites on the side. But I'm a *NIX/Apache guy, so if Microsoft is involved anywhere in this process I may not be much help.
** Sent from my rotary dial phone using TwirlaWord **
JimmyN is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 06:41.

GT Wiki
GT Blogs
Social Groups
GT Store

Users Currently Online: 755
235 Members
520 Guests

Most users ever online: 4,867
May 19, 2015 at 1:03